Python Django测试MySQL权限
我正在学习Django教程,我遇到了一些麻烦,因为我使用MySQL作为我的数据库 当我跑的时候Python Django测试MySQL权限,python,mysql,django,Python,Mysql,Django,我正在学习Django教程,我遇到了一些麻烦,因为我使用MySQL作为我的数据库 当我跑的时候 python manage.py test polls 我明白了 Creating test database for alias 'default'... Got an error creating the test database: (1044, "Access denied for user 'USER123'@'%' to database 'test_USER12
python manage.py test polls
我明白了
Creating test database for alias 'default'...
Got an error creating the test database: (1044, "Access denied for user 'USER123'@'%' to database 'test_USER123'")
Type 'yes' if you would like to try deleting the test database 'test_USER123', or 'no' to cancel:
这是我的设置.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'USER123', # Or path to database file if using sqlite3.
# The following settings are not used with sqlite3:
'USER': 'USER123',
'PASSWORD': 'PASSWORD',
'HOST': '', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
'PORT': '', # Set to empty string for default.
}
}
我想知道是否有人会向我解释什么是错的,发生了什么事。谢谢大家! 可能重复的@Hedde在这种情况下,引发相同错误消息的PHP问题如何有帮助?@Liondancer您必须首先在MySQL中创建一个用户
USER123
,并使用密码password
。(请务必使用您自己的用户名/密码/数据库名)@Hedde如果它与PHP或Python/Django无关,我看不出它会是一个与某些PHP框架明显相关的问题的重复。@Liondator您必须以数据库管理员用户的身份执行这些创建用户和授予查询。