Note that there are some explanatory texts on larger screens.

plurals
  1. PODjango's syncdb fails with MySQL errno: 150
    primarykey
    data
    text
    <p>First off, here's my current setup:</p> <p>Django : version 1.3</p> <p>MySQL : version 4.0.18 (not my 1st choice...)</p> <p>When I run syncdb, I get the following error:</p> <pre><code>Creating tables ... Creating table auth_permission Creating table auth_group_permissions Traceback (most recent call last): File "C:\path_to_app\manage.py", line 14, in &lt;module&gt; execute_manager(settings) File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 438, in execute_manager utility.execute() File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 379, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "C:\Python27\lib\site-packages\django\core\management\base.py", line 191, in run_from_argv self.execute(*args, **options.__dict__) File "C:\Python27\lib\site-packages\django\core\management\base.py", line 220, in execute output = self.handle(*args, **options) File "C:\Python27\lib\site-packages\django\core\management\base.py", line 351, in handle return self.handle_noargs(**options) File "C:\Python27\lib\site-packages\django\core\management\commands\syncdb.py", line 101, in handle_noargs cursor.execute(statement) File "C:\Python27\lib\site-packages\django\db\backends\util.py", line 34, in execute return self.cursor.execute(sql, params) File "C:\Python27\lib\site-packages\django\db\backends\mysql\base.py", line 86, in execute return self.cursor.execute(query, args) File "C:\Python27\lib\site-packages\MySQLdb\cursors.py", line 174, in execute self.errorhandler(self, exc, value) File "C:\Python27\lib\site-packages\MySQLdb\connections.py", line 36, in defaulterrorhandler raise errorclass, errorvalue _mysql_exceptions.OperationalError: (1005, "Can't create table '.\\database_name\\#sql-d64_e75f2.frm' (errno: 150)") </code></pre> <p>From what I understand it has something to do with how InnoDB handles foreign keys. Here's what my setting file looks like:</p> <pre><code>DATABASES = { 'default': { .... 'OPTIONS': { 'init_command': 'SET table_type=INNODB;', 'charset': 'latin1'}, }, } </code></pre> <p>When "SET table_type=INNODB" is not specfied, everything runs smoothly. I've looked around on the net and it seems the InnoDB engine doesn't like something about <a href="https://code.djangoproject.com/ticket/8200">the SQL Django is generating</a></p> <p>For now, the only work around I found, was tho create the tables myself, and use inspectDB to generate the models... </p> <p>Is there a fix for this? Thanks!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload