开发者

Running syncdb on Django project not working: Can't create/write to file

开发者 https://www.devze.com 2022-12-17 20:00 出处:网络
When I run: $ python manage.py syncdb I get the following output: Creating table auth开发者_Python百科_permission

When I run:

$ python manage.py syncdb

I get the following output:

Creating table auth开发者_Python百科_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

shell> cd /usr/local/mysql/data/
shell> ls -ld *
drwx------    17 geert   admin         578 Oct  1 19:33 someabstract

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.)


This might help:

agos@server:~$ perror 2
OS error code 2: No such file or directory

Is your MySQL configured correctly? Try querying it yourself via mysql command.
Also, as luc suggested in the comment, try with sqlite.

0

精彩评论

暂无评论...
验证码 换一张
取 消