当我跑步时:
$ python manage.py syncdb
我得到以下输出:
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)")
关于如何调试的任何想法?我已经为数据库用户提供了它应该需要的所有权限。不确定MySQL在这里徘徊。
更新:这里的问题最终是我多次安装了MySQL(当我意识到我应该这样做时,先是32位,然后是64位)虽然我遵循了一些指令关于如何卸载MySQL,Snow Leopard的说明略有不同。一旦我实际进行了卸载和干净安装,这个问题就消失了。
答案 0 :(得分:4)
问题是如何调试问题,正如Agos已经指出的那样,Errno 2是“没有这样的文件或目录”。您可能希望查看MySQL的数据目录并检查该目录是否确实存在且具有正确的权限
shell> cd /usr/local/mysql/data/
shell> ls -ld *
drwx------ 17 geert admin 578 Oct 1 19:33 someabstract
以上内容应该为您提供目录列表(MySQL数据库)及其权限。检查'wzhere'目录是否特别.. 你应该说这是一个有点奇怪的错误信息。
(尝试另一个Django DB后端在这种情况下无法解决任何问题。)
答案 1 :(得分:2)
这可能会有所帮助:
agos @ server:〜$ perror 2
操作系统错误代码2:没有这样的文件或目录
你的MySQL配置正确吗?尝试通过mysql
命令自行查询
另外,正如评论中提到的那样,请尝试使用sqlite。