Forums

ERROR 2005 (HY000): Unknown MySQL server host 'PLCMGR.mysql.pythonanywhere-services.com' (2)

I have been trying to acces to mysql by bash by:

mysql -h PLCMGR.mysql.pythonanywhere-services.com -u PLCMGR 'PLCMGR$DataBase' -p

And i keep geting error like this:

ERROR 2005 (HY000): Unknown MySQL server host 'PLCMGR.mysql.pythonanywhere-services.com' (2)

Also in my code when I type in:

SQLALCHEMY_DATABASE_URI = "mysql+mysqlconnector://{username}:{password}@{hostname}/{databasename}".format(
username="PLCMGR",
password="haslo123", # database passowrd hidden
hostname="PLCMGR.mysql.pythonanywhere-services.com",
databasename="PLCMRG$DataBase",
)
app.config["SQLALCHEMY_DATABASE_URI"] = SQLALCHEMY_DATABASE_URI

I get Error in my logs that says:

sqlalchemy.exc.InterfaceError: (mysql.connector.errors.InterfaceError) 2003: Can't connect to MySQL server on 'PLCMGR.mysql.pythonanywhere-services.com:3306' (-2 Name or service not known)

I am not sure if these two things are somehow connected. Is there anyone who has idea how to solve it? I have copied host name right from Databases site

hostname is PLCMRG.mysql.pythonanywhere-services.com not PLCMGR.mysql.pythonanywhere-services.com

In bash console now i get

ERROR 1045 (28000): Access denied for user 'PLCMGR'@'10.0.0.144' (using password: YES)

and in error logs i am still geting

sqlalchemy.exc.InterfaceError: (mysql.connector.errors.InterfaceError) 2003: Can't connect to MySQL server on 'PLCMGR.mysql.pythonanywhere-services.com:3306' (-2 Name or service not known)

I dont realy see any difference between two things you wrote. They looks the same.