2013-08-20 28 views
0

在django中,我在現有數據庫中創建新模型。在同步模型時會顯示錯誤。我無法解決這些問題。我使用mysql作爲數據庫。我添加了錯誤代碼。請分享您的想法。同步數據庫時Django錯誤代碼28(MySQL)

python manage.py syncdb 
Creating tables ... 
Creating table registration_securityquestions 
Traceback (most recent call last): 
    File "manage.py", line 14, in <module> 
    execute_manager(settings) 
    File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 459, in execute_manager 
    utility.execute() 
    File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 382, in execute 
    self.fetch_command(subcommand).run_from_argv(self.argv) 
    File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 196, in run_from_argv 
    self.execute(*args, **options.__dict__) 
    File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 232, in execute 
    output = self.handle(*args, **options) 
    File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 371, in handle 
    return self.handle_noargs(**options) 
    File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/syncdb.py", line 102, in handle_noargs 
    cursor.execute(statement) 
    File "/usr/local/lib/python2.7/dist-packages/django/db/backends/util.py", line 40, in execute 
    return self.cursor.execute(sql, params) 
    File "/usr/local/lib/python2.7/dist-packages/django/db/backends/mysql/base.py", line 114, in execute 
    return self.cursor.execute(query, args) 
    File "/usr/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute 
    self.errorhandler(self, exc, value) 
    File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler 
    raise errorclass, errorvalue 
django.db.utils.DatabaseError: (3, "Error writing file './userregdb/registration_securityquestions.frm' (Errcode: 28)") 

回答

2

MySQL doc

上述錯誤是用於Windows的典型消息; Unix消息類似。

一種修復方法是使用--tmpdir選項啓動mysqld,或將選項添加到選項文件的[mysqld]部分。例如,要指定C:\temp的目錄,請使用以下行:

[mysqld] 
tmpdir=C:/temp