weixin_43976099
宁菇凉
采纳率0%
2018-12-05 12:14

django中创建表python manage.py makemigrations出现以下错误 ,望大神指导

图片说明
图片说明

C:\Users\Administrator\PycharmProjects\mysite>python manage.py makemigrations
Traceback (most recent call last):
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\backend
s\base\base.py", line 216, in ensure_connection
self.connect()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\backend
s\base\base.py", line 194, in connect
self.connection = self.get_new_connection(conn_params)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\backend
s\mysql\base.py", line 227, in get_new_connection
return Database.connect(**conn_params)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pymysql__init__.
py", line 94, in Connect
return Connection(*args, **kwargs)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pymysql\connectio
ns.py", line 327, in init
self.connect()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pymysql\connectio
ns.py", line 598, in connect
self._request_authentication()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pymysql\connectio
ns.py", line 873, in _request_authentication
auth_packet = _auth.caching_sha2_password_auth(self, auth_packet)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pymysql_auth.py"
, line 253, in caching_sha2_password_auth
pkt = _roundtrip(conn, data)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pymysql_auth.py"
, line 112, in _roundtrip
pkt = conn._read_packet()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pymysql\connectio
ns.py", line 683, in _read_packet
packet.check_error()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pymysql\protocol.
py", line 220, in check_error
err.raise_mysql_exception(self._data)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pymysql\err.py",
line 109, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.OperationalError: (1045, "Access denied for user 'root'@'localhost' (using password: YES)")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "manage.py", line 15, in
execute_from_command_line(sys.argv)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\manag
ement__init__.py", line 381, in execute_from_command_line
utility.execute()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\manag
ement__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\manag
ement\base.py", line 316, in run_from_argv
self.execute(*args, cmd_options)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\manag
ement\base.py", line 353, in execute
output = self.handle(*args, **options)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\manag
ement\base.py", line 83, in wrapped
res = handle_func(*args, **kwargs)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\manag
ement\commands\makemigrations.py", line 103, in handle
loader.check_consistent_history(connection)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\migrati
ons\loader.py", line 281, in check_consistent_history
applied = recorder.applied_migrations()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\migrati
ons\recorder.py", line 61, in applied_migrations
if self.has_table():
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\migrati
ons\recorder.py", line 44, in has_table
return self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cur
sor())
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\backend
s\base\base.py", line 255, in cursor
return self._cursor()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\backend
s\base\base.py", line 232, in cursor
self.ensure_connection()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\backend
s\base\base.py", line 216, in ensure_connection
self.connect()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\utils.p
y", line 89, in __exit
_
raise dj_exc_value.with_traceback(traceback) from exc_value
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\backend
s\base\base.py", line 216, in ensure_connection
self.connect()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\backend
s\base\base.py", line 194, in connect
self.connection = self.get_new_connection(conn_params)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\backend
s\mysql\base.py", line 227, in get_new_connection
return Database.connect(
conn_params)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pymysql__init__.
py", line 94, in Connect
return Connection(*args, **kwargs)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pymysql\connectio
ns.py", line 327, in init
self.connect()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pymysql\connectio
ns.py", line 598, in connect
self._request_authentication()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pymysql\connectio
ns.py", line 873, in _request_authentication
auth_packet = _auth.caching_sha2_password_auth(self, auth_packet)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pymysql_auth.py"
, line 253, in caching_sha2_password_auth
pkt = _roundtrip(conn, data)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pymysql_auth.py"
, line 112, in _roundtrip
pkt = conn._read_packet()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pymysql\connectio
ns.py", line 683, in _read_packet
packet.check_error()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pymysql\protocol.
py", line 220, in check_error
err.raise_mysql_exception(self._data)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pymysql\err.py",
line 109, in raise_mysql_exception
raise errorclass(errno, errval)
django.db.utils.OperationalError: (1045, "Access denied for user 'root'@'localhost' (using password: YES)
")

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

2条回答

  • hxflove521 万人空巷 3年前

    最后一行不是很明显么?没有权限啊~

    点赞 评论 复制链接分享
  • crf_moonlight crf_moonlight 3年前

    "ENGINE"里面, 点打成逗号了

    点赞 评论 复制链接分享

相关推荐