Access Denied Problem When Connecting to Remote MySQL Servers

Do you like this?

Summary:
If you are having a MySQL server and want to develop a standalone application to connect to the server remotely, you might experience this connection problem: OperationalError - 1044 - Access denied for user. This post shows you the answer to the problem regardless of the programming language you are using such as Python, Java or .Net.


Content:

It's very likely that you haven't been granted permissions to connect to your MySQL server remotely. You can check this out by running this command from your local computer:

mysql.exe -u username -h server.example.com -p
It means that you need to have an instance of MySQL installed on your computer so that you can have access to the file mysql.exe. If you can connect, it means there are bugs in your code. On the contrary, if you can't connect to your server, it means you don't have permissions to connect remotely.

What you have to do is to run this command on your server using SSH to connect:
GRANT ALL ON my_database.* TO username@'%' IDENTIFIED BY 'some_password';
You also might find this command doesn't work for you. It's because you are running on a shared server. Hence, you need to send a ticket requesting remote access and the database name you need it enabled for to the admin of the server.

 
comments powered by Disqus