How to connect to remote MySql server

Submitted by admin on Sun, 02/18/2018 - 16:49

To do so you should enable connection from the remote server.

In DirectAdmin:

go to "MySQL Management"  and click on each domain name you want to have access remotely, in section "Access Hosts" below the page you should add the IP address of the remote server and then click on the "Add Host" button.

 

In command line:

login to your MySQL console with root access

mysql -u root -p

then run the following command:

GRANT ALL ON database_name.* TO username@’remote_server_ip’ IDENTIFIED BY ’password’;

 

be aware of your server firewall and allow your connection from the remote server.