Remote MySQL connection Print

  • mysql, remote, remote mysql
  • 87

Sometimes, you would need to enable a user to connect to a MySQL database remotely and, though it may seem somewhat complicated, it really is not, requiring root access and just a few commands.

Firist of all you should know the IP of the user connecting to it, which you can see at http://cmyip.com or similar services.

After this, you would need to allow it to connect, which requires the follwing procedure:

*Log into your MySQL server, using the command: mysql -u root -p
You will get promted for the password, where you can use the root password

*Grant permissions to the remote user
GRANT ALL ON YourDatabase.* TO RemoteUser@’IP’ IDENTIFIED BY ‘user_password’;

To test it, you would need to run the following command, preferrably on a different server:
mysql -u RemoteUser -p -h IP
After this, you should be requested to enter the password.

Please note that the remote connection port for MySQL is 3306, which would need to be open on your server to connect to it.

 


Was this answer helpful?

« Back