Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#1424 closed enhancement (worksforme)

tutorial barfs owing to mysql settings?

Reported by: nicholasjames2@… Owned by: Adrian Holovaty
Component: contrib.admin Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


everything going great guns until I got to tutorial02.txt line 46
so far as I can remember I've got a default installation of mysql
looks like a great package. Do you know if it works with cygwin?

trace follows:
C:\usr\NIK\dev\try_on\django\myproject>c:\Python24\python.exe createsuperuser
Username (only letters, digits and underscores): django
Traceback (most recent call last):

File "", line 11, in ?


File "c:\python24\lib\site-packages\Django-0.91-py2.4.egg\django\core\", line 990, in execute_manager


File "c:\python24\lib\site-packages\Django-0.91-py2.4.egg\django\core\", line 910, in execute_from_command_line


File "c:\python24\lib\site-packages\Django-0.91-py2.4.egg\django\core\", line 515, in createsuperuser


File "c:\python24\lib\site-packages\Django-0.91-py2.4.egg\django\utils\", line 3, in _curried

return args[0](*(args[1:]+moreargs), dict(kwargs.items() + morekwargs.items()))

File "c:\python24\lib\site-packages\Django-0.91-py2.4.egg\django\core\meta\", line 1355, in function_get_object

obj_list = function_get_list(opts, klass, kwargs)

File "c:\python24\lib\site-packages\Django-0.91-py2.4.egg\django\core\meta\", line 1395, in function_get_list

return list(function_get_iterator(opts, klass, kwargs))

File "c:\python24\lib\site-packages\Django-0.91-py2.4.egg\django\core\meta\", line 1378, in function_get_iterator

cursor.execute("SELECT " + (kwargs.get('distinct') and "DISTINCT " or "") + ",".join(select) + sql, params)

File "c:\python24\lib\site-packages\Django-0.91-py2.4.egg\django\core\db\", line 10, in execute

result = self.cursor.execute(sql, params)

File "c:\python24\lib\site-packages\Django-0.91-py2.4.egg\django\core\db\backends\", line 32, in execute

return self.cursor.execute(sql, params)

File "C:\Python24\Lib\site-packages\MySQLdb\", line 137, in execute

self.errorhandler(self, exc, value)

File "C:\Python24\Lib\site-packages\MySQLdb\", line 33, in defaulterrorhandler

raise errorclass, errorvalue

_mysql_exceptions.OperationalError: (1267, "Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBL
E) for operation '='")

Change History (5)

comment:1 Changed 11 years ago by Adrian Holovaty

Have you tried setting your TIME_ZONE setting?

comment:2 Changed 11 years ago by Eric Woudenberg

priority: lowestnormal
Severity: minornormal

I am also getting this on a FreeBSD system using MySQLdb:

_author = "Andy Dustman <andy@…>"
revision = """$Revision: 1.37 $"""[11:-2]

And Django trunk revision 2645:

dharmaseed@zoot$ svn info /usr/local/etc/django_src/
Path: /usr/local/etc/django_src
Repository Root:
Repository UUID: bcc190cf-cafb-0310-a4f2-bffc1f526a37
Revision: 2645
Node Kind: directory
Schedule: normal
Last Changed Author: adrian
Last Changed Rev: 2645
Last Changed Date: 2006-04-09 17:32:42 -0700 (Sun, 09 Apr 2006)
Properties Last Updated: 2006-04-09 19:09:52 -0700 (Sun, 09 Apr 2006)

Any workarounds you might suggest?

comment:3 Changed 11 years ago by Adrian Holovaty

Resolution: worksforme
Status: newclosed

comment:4 Changed 11 years ago by anonymous

I think this is the issue: when you create your Django database, select the "utf8_general_ci" collation. Somehow the default MySQL collation is "latin1_swedish_ci" and that's what causes problems.

comment:5 Changed 10 years ago by slackeur

Thanks. This addressed my issue exactly, and the solution worked.

BTW, the mysql command that works is:

CREATE DATABASE foo COLLATE utf8_general_ci;

Note: See TracTickets for help on using tickets.
Back to Top