we have a server with LAMP setup and virtualmin installed. Now, we want to access the database on this server from some different server.

Can someone please help me with exact settings I need to do on both the servers ?

Also, how can I check the port mysql server is using ? It's a centos os based server.


First you need to check that your MySQL server is reachable from the network. If it's listening on (like below), you need to modify your my.cnf file and add a "bind-address =" (for example).

$ netstat -tpan | grep :3306
tcp        0      0*               LISTEN      -               

Then, check you don't have any firewall rule (iptables) wich will block the 3306/tcp port from outside.

And at last, you need to create the user, allowed to connect from the remote IP. For example :

GRANT ALL ON `remoteuser`.* TO `mydatabase`@'' IDENTIFIED BY 'thepasswordhere' ;

I hope it helps !

  • (and it'd be a good idea to check that there are no firewall routing issues between the boxes - running the mysql cli client will help) – symcbean Feb 22 '11 at 11:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.