Basic reference information on how to setup a remote access to Mysql. This is recommended for advanced users, that have linux knowledge, plus I’m doing this with CentOS so it will be different for the other variations. You would need remote access in some cases for additional servers to access it or remotely administer the Mysql server. In my case I have a completely dedicated Mysql server to help decrease the load on a few of my heavy used websites that have the database on the same server.

Alright so here we go, start the install of Mysql.

yum install mysql mysql-devel mysql-server

Now we run the secure install:


Pretty straight forward, allows you to setup root password, remove test db and remove anonymous access.

After you run that, setup centos to run it at startup.

chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start

Now go in and edit the main config file:

vi /etc/my.cnf

When you get in there we need to add two things:

bind-address= YOUR IP ADDRESS

Simple enough, of course swap out the “YOUR IP ADDRESS” to your Mysql server ip address. Restart the server:

/etc/init.d/mysqld restart

After you restart your Mysql server, now we need to setup your server with an account that has remote access. First login to mysql:

mysql -u root -p

Second, Create a user:

CREATE USER 'yourusername'@'localhost' IDENTIFIED BY 'yourpassword';

Once logged in type in this command below, make sure to change the variables!


After that, run flush privileges:

mysql> flush privileges;

Thats the basics, Highly recommend you look at some methods of security to lock down your server. I take no responsibility if your server gets hacked. If you cant get this to work, post your issue in the comments and Ill see if I can help.