I use www.pythonanywhere.com to deploy my Django project. The pythonanywhere database options are as follows:
Connecting:
Database host address: mysql.server
Username: Username (just as an example)
Your databases:
Start a console on: Username$DBName (just as an example)
...
When configuring a database using the "manage.py migrate" command, an error message appears:
django.db.utils.OperationalError: (1044 "Access denied for user 'Username'@'%' to database 'DBName'")
The DATABASES settings in the file are settings.pyas follows.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'DBName',
'USER': 'Username',
'PASSWORD': 'password',
'HOST': 'mysql.server',
'PORT': '3306',
}
}
I can start mysql in the console using the command:
$ mysql -u Username -h mysql.server -p
When I enter the following command:
mysql> use mysql;
I got an error message:
ERROR 1044 (42000): Access denied for user 'Username'@'%' to database 'mysql'
"show databases;" the command shows that there is no database named "mysql".
When I enter the following command:
mysql> GRANT ALL PRIVILEGES ON DBName.* TO 'Username'@'Username$DBName' IDENTIFIED BY 'password' WITH GRANT OPTION;
I also received an error message:
ERROR 1044 (42000): Access denied for user 'Username'@'%' to database 'DBName'
So how do I set up a database?