skip to Main Content

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


  1. 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.

    Login or Signup to reply.
  2. Give the permissions:

    GRANT ALL PRIVILEGES ON my_db.* TO 'my_user'@'10.55.1.98' IDENTIFIED BY 'password';
    FLUSH PRIVILEGES;
    

    Test with Command Line Again with properly connecting:

    mysql -u my_user -p -h 10.55.1.95 -P 3306 my_db
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search