mysql - 同步数据库 (MySQL) 时 Django 错误代码 28

标签 mysql django django-models

在 django 中,我在现有数据库中创建新模型。同步模型时显示错误。我无法解决这些问题。我使用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)")

最佳答案

来自MySQL doc :

上述错误是 Windows 的典型消息; Unix 消息类似。

一个修复方法是使用 --tmpdir 选项启动 mysqld,或者将该选项添加到选项文件的 [mysqld] 部分。例如,要指定 C:\temp 目录,请使用以下行:

[mysqld]
tmpdir=C:/temp

关于mysql - 同步数据库 (MySQL) 时 Django 错误代码 28,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18327548/

相关文章:

php - 检查数据库中的新条目

mysql - 在 Linux 机器上远程连接到 mysql 时出现问题

python - 如何将属性方法用作查询中的字段?

python - psycopg2.errors.UndefinedTable : relation "authentication_author" does not exist: Django v4

python - 更新实例时的Django Form字段初始值

mysql - MySQL包装连接条件与另一个条件?

php - 如何通过mysql_connect php函数连接到我自己的服务器

java - Android中的Django JsonResponse解析错误

python - 如何防止 Django 1.11 为非托管模型创建迁移?

django 手动将模型字段添加到 postgres 数据库