I am trying to deploy a django project on pythonanywhere but it is giving error-
(2003, "Can't connect to MySQL server on 'mysql.server' (111)")
I have seen many questions already asked for this problem but no answer solves my problem. May be there is a previlleges problem with accessing the database .
Database settings are-
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'mutechrobotics$mutech_db', 'USER': 'mutechrobotics', 'PASSWORD':'root', 'HOST': 'mysql.server', } }
On running show grants command following databases are displaying(Actually i only need one database out of them but i am unable to drop the extra ones)
mysql> show grants ;
+-------------------------------------------------------------------------------------------------------------------------------------------+
| Grants for mutechrobotics@% |
+-------------------------------------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'mutechrobotics'@'%' IDENTIFIED BY PASSWORD '*81F5E21E35407D884A6CD4A731AEBFB6AF209E1B' WITH MAX_USER_CONNECTIONS 3 |
| GRANT ALL PRIVILEGES ON `mutechrobotics$default`.* TO 'mutechrobotics'@'%' |
| GRANT ALL PRIVILEGES ON `mutechrobotics$mutechnew_db`.* TO 'mutechrobotics'@'%' |
| GRANT ALL PRIVILEGES ON `mutechrobotics$mutech_db`.* TO 'mutechrobotics'@'%' |
| GRANT ALL PRIVILEGES ON `mutechrobotics$mu_db`.* TO 'mutechrobotics'@'%' |
+-------------------------------------------------------------------------------------------------------------------------------------------+
5 rows in set (0.00 sec)
my.cnf file is-
[client] password = "root"
When i try to give all previleges to user- "mutechrobotics" then i am getting the following error-
mysql> GRANT ALL PRIVILEGES ON *.* TO 'mutechrobotics'@'%'
IDENTIFIED BY PASSWORD 'root';
ERROR 1045 (28000): Access denied for
user 'mutechrobotics'@'%' (using password: YES)
While trying to login as a root i am getting the error as-
mysql> mysql -u root -p ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysql
-u root -p' at line 1
Somebody please help me sort out this problem.
Using mysql.server
as the hostname is deprecated. According to the official PythonAnywhere Django tutorial, you should now use:
'HOST': 'username.mysql.pythonanywhere-services.com',
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With