My local Django is blowing up running the manage.py syncdb script that runs on our servers.
This is the error message I'm seeing when running python manage.py syncdb,
OperationalError: (1193, "Unknown system variable 'TRANSACTION'")
It looks like a MySQL issue, just for reference I have MySQL-python 1.2.4 install with Django 1.5.1 in a virtual env and I am running MySQL version 5.6.10.
This is my current virtual env in full from pip list,
Django (1.5.1)
MySQL-python (1.2.4)
pymongo (2.5.2)
python-cjson (1.0.5)
wsgiref (0.1.2)
I'm not very proficient with Django and Googling has turned up nothing, could anyone tell me what might be going here?
Full trackback of the command below
Traceback (most recent call last):
File "/Users/jamesmcmahon/src/business-intelligence/mongo2mysql/venv/lib/python2.7/site-packages/django/core/management/base.py", line 222, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Users/jamesmcmahon/src/business-intelligence/mongo2mysql/venv/lib/python2.7/site-packages/django/core/management/base.py", line 255, in execute
output = self.handle(*args, **options)
File "/Users/jamesmcmahon/src/business-intelligence/mongo2mysql/venv/lib/python2.7/site-packages/django/core/management/base.py", line 385, in handle
return self.handle_noargs(**options)
File "/Users/jamesmcmahon/src/business-intelligence/mongo2mysql/venv/lib/python2.7/site-packages/django/core/management/commands/syncdb.py", line 56, in handle_noargs
cursor = connection.cursor()
File "/Users/jamesmcmahon/src/business-intelligence/mongo2mysql/venv/lib/python2.7/site-packages/django/db/backends/__init__.py", line 326, in cursor
cursor = util.CursorWrapper(self._cursor(), self)
File "/Users/jamesmcmahon/src/business-intelligence/mongo2mysql/venv/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 405, in _cursor
self.connection = Database.connect(**kwargs)
File "/Users/jamesmcmahon/src/business-intelligence/mongo2mysql/venv/lib/python2.7/site-packages/MySQLdb/__init__.py", line 81, in Connect
return Connection(*args, **kwargs)
File "/Users/jamesmcmahon/src/business-intelligence/mongo2mysql/venv/lib/python2.7/site-packages/MySQLdb/connections.py", line 187, in __init__
super(Connection, self).__init__(*args, **kwargs2)
OperationalError: (1193, "Unknown system variable 'TRANSACTION'")
EDIT:
I found the exact line causing the issues, in my settings.py
DATABASES = {
'default': {
'NAME': 'test',
'ENGINE': 'django.db.backends.mysql',
'USER': 'redacted',
'PASSWORD': 'redacted',
'HOST': 'localhost'
'OPTIONS': { "init_command": "SET storage_engine=INNODB, SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED" }
},
}
The options line, when committed out, fixes the issue. Only thing I can think of is that the server is running MySQL 5.5 and I am running 5.6 locally.
I'd still like to figure out exactly what is going on.
use
DATABASES = {
'default': { 'NAME': 'test', 'ENGINE': 'django.db.backends.mysql', 'USER': 'redacted', 'PASSWORD': 'redacted', 'HOST': 'localhost' 'OPTIONS': { "init_command": "SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED"}},
}
ie without "storage_engine=INNODB,". The latest versions of MySql engine by default INNODB.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With