Skip to content

Instantly share code, notes, and snippets.

@venkatesh22
Created August 3, 2013 07:23
Show Gist options
  • Save venkatesh22/6145572 to your computer and use it in GitHub Desktop.
Save venkatesh22/6145572 to your computer and use it in GitHub Desktop.
OperationalError (1267, "Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '='")
$ manage.py shell
>>> from django.db import connection
>>> cursor = connection.cursor()
>>> cursor.execute('SHOW TABLES')
>>> results=[]
>>> for row in cursor.fetchall(): results.append(row)
>>> for row in results: cursor.execute('ALTER TABLE %s CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;' % (row[0]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment