(2003, "Unable to connect to MySQL server with error 'mysql.server" (111) ") in pythonanywhere

I am trying to deploy a django project on pythonanywhere but it gives an error -

(2003, "Can't connect to MySQL server on 'mysql.server' (111)")

I have seen many questions already asked by this problem, but the answer does not solve my problem. Maybe there is a previlleges problem with accessing the database.

Database Settings -

 DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'mutechrobotics$mutech_db', 'USER': 'mutechrobotics', 'PASSWORD':'root', 'HOST': 'mysql.server', } } 

When the show grants command is run, the following databases are displayed (in fact, I only need one database, but I can’t delete 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 -

  [client] password = "root" 

When I try to give all preludes to the user - "mutechrobotics", then I get 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) 

When I try to log in as root, I get an error message like -

  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 

Someone please help me deal with this issue.

+5
source share
1 answer

Using mysql.server as hostname is out of date. According to the official PythonAnywhere Django tutorial , you should now use:

 'HOST': 'username.mysql.pythonanywhere-services.com', 
+4
source

Source: https://habr.com/ru/post/1247670/


All Articles