I have a server running at let’s say 10.55.1.95
that runs MySQL database engine. I try connecting to it on a different server lets say 10.55.1.98
via a connection string like
sql_alchemy_conn=mysql+mysqldb://my_user:[email protected]/my_db
but I get an error saying access denied for user [email protected]. I can connect perfectly to the database via command line MySQL -u my_user -p -h 10.55.1.95 -P 3306 my_db
. How do. I solve this connection string issue? I have the my_user setup to allow all hosts %
I also have a password that contains special characters like 1@??ZNbhg
. I am using mysqlconnector
2
Answers
Ensure the my_user user has appropriate permissions to connect from any host or specifically from 10.55.1.98. If the user doesn’t have the access, grant it explicitly..
Confirm that MySQL is listening on the correct IP address. Check mysql conf file for bind-address which should be 0.0.0.0 or 10.55.1.98. Make sure it is not 127.0.0.1.
Restart SQL servers after these 2 updates and see if it worked out. If not, ensure the firewall on the server 10.55.1.95 allows incoming connections on port 3306 from 10.55.1.98.
Give the permissions:
Test with Command Line Again with properly connecting: