Remote server configuration
1. Edit the /etc/my.cnf file in the remote server and add the following line somewhere under [mysqld] in the my.cnf file
bind-address=<IP address of the remote server>
2. Restart mysql on the server
Granting privileges for database::
In order to access a database ‘abc’ on the remote server from another machine, we need to add sufficient privileges for a user in the machine from which the connection is made. i.e. from the mysql prompt ( use mysql command or mysql -u root -p to enter the prompt).
mysql> grant all privileges on abc.* to username@IP address of the machine from which the connection is to be made identified by <password>
Example::
Let us consider two machines with the following data
Remote server IP:: xxx.xxx.x.1
Ip of local machine from which connections to remote database in xxx.xxx.x.1 are made:: xxx.xxx.x.100
Edit the my.cnf file in the remote server and add the following
bind-address = xxx.xxx.x.1
anywhere under [mysqld]
Inorder to grant permissions for the user ‘bl’ from xxx.xxx.x.100 to connect to the database ‘ab’ in xxx.xxx.x.1 , enter the mysql prompt and type in the command
mysql>grant all privileges for ab.* to bl@ xxx.xxx.x.100 identified by pass; (# where pass is the password)
mysql>flush privileges;
mysql>exit
Checking for mysql connectivity from xxx.xxx.x.100 to xxx.xxx.x.1
Enter the command below in the machine xxx.xxx.x.100 and type in the password pass upon the prompt
[root@local ~]# mysql -u bl -h xxx.xxx.x.1 -p
Inorder to specify the remote database name and location for a site software like wordpress, joomla etc. , modify the configuration file and update the details of the database along with the password and IP address of the remote server in the specified filed.
Inorder to configure wordpress to access the database ‘ab’ from a remote machine xxx.xxx.x.1, modify the configuation file as below
define(‘DB_NAME’, ‘ab’);
define(‘DB_USER’, ‘bl’);
define(‘DB_PASSWORD’, ‘pass’);
define(‘DB_HOST’, ‘ xxx.xxx.x.1’);
If you require help, contact SupportPRO Server Admin
