Opened 19 years ago

Closed 19 years ago

Last modified 18 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: no UI/UX: no

Description

Hi,
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 manage.py createsuperuser
Username (only letters, digits and underscores): django
Traceback (most recent call last):

File "manage.py", line 11, in ?

execute_manager(settings)

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

execute_from_command_line(action_mapping)

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

action_mapping[action]()

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

users.get_object(usernameexact=username)

File "c:\python24\lib\site-packages\Django-0.91-py2.4.egg\django\utils\functional.py", 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\init.py", 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\init.py", 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\init.py", 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\base.py", 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\mysql.py", line 32, in execute

return self.cursor.execute(sql, params)

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

self.errorhandler(self, exc, value)

File "C:\Python24\Lib\site-packages\MySQLdb\connections.py", 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 by Adrian Holovaty, 19 years ago

Have you tried setting your TIME_ZONE setting?

comment:2 by Eric Woudenberg, 19 years ago

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
URL: http://code.djangoproject.com/svn/django/trunk
Repository Root: http://code.djangoproject.com/svn
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 by Adrian Holovaty, 19 years ago

Resolution: worksforme
Status: newclosed

comment:4 by anonymous, 19 years ago

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 by slackeur , 18 years ago

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