When I run:
$ python manage.py syncdb
I get the following output:
Creating table auth_permission
Traceback (most recent call last):
File "manage.py", line 11, in <module>
execute_manager(settings)
File "/Library/Python/2.6/site-packages/django/core/management/__init__.py", line 362, in execute_manager
utility.execute()
File "/Library/Python/2.6/site-packages/django/core/management/__init__.py", line 303, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 195, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 222, in execute
output = self.handle(*args, **options)
File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 351, in handle
return self.handle_noargs(**options)
File "/Library/Python/2.6/site-packages/django/core/management/commands/syncdb.py", line 78, in handle_noargs
cursor.execute(statement)
File "/Library/Python/2.6/site-packages/django/db/backends/util.py", line 19, in execute
return self.cursor.execute(sql, params)
File "/Library/Python/2.6/site-packages/django/db/backends/mysql/base.py", line 84, in execute
return self.cursor.execute(query, args)
File "build/bdist.macosx-10.6-universal/egg/MySQLdb/cursors.py", line 173, in execute
File "build/bdist.macosx-10.6-universal/egg/MySQLdb/connections.py", line 36, in defaulterrorhandler
_mysql_exceptions.InternalError: (1, "Can't create/write to file '/usr/local/mysql/data/wzhere/auth_permission.MYI' (Errcode: 2)")
Any ideas on how to debug? I’ve given the database user all the permissions it should need. Not sure what MySQL is balking at here.
UPDATE: The problem here ended up being that I had installed MySQL multiple times (first 32-bit, then 64-bit when I realized I should be doing that) and although I followed some instructions on how to un-install MySQL, the instructions are slightly different for Snow Leopard. Once I actually did an uninstall and clean install, this problem went away.
The question was how to debug the problem and as already pointed out by Agos, Errno 2 is ‘No such file or directory’. You might want to look in the data directory of MySQL and check if the directory is actually there and has correct permissions
The above should give you list of directories (which are the MySQL databases) and their permissions. Check whether the ‘wzhere’ directory in particular..
It’s a bit weird error message you get I should say.
(Trying another Django DB back-end wouldn’t solve anything in this case.)