MySQL Master-Slave replication between CentOS 6 cPanel server

Here I am going to illustrate how to replicate MySQL database between Master and Slave Servers.


Two cPanel preinstalled servers with same versions of MySQL database server.

eg :

Master server –

Slave server –

Master server configuration

Default location of MySQL server configuration file will be located at /etc/my.cnf

Add the following changes to the configuration file,

binlog-ignore-db="mysql"   #ignores mysql database from replication

Here server-id=1 is used to represent it  as a master server.


and knowing about log-bin you may refer the following article

Restart MySQL service by using the following command.

service mysql restart

Now, we need to setup access from slave node to master node,so we need to make the following changes in master node MySQL server.

Enter into MySQL server by using the command


In a Cpanel installed server, it is not necessary to access MySQL using username and password.If that doesn’t work you will have to use the following command.

mysql -u root -p

It will show up like this if you succeed,


Now give the privileges using the following command

mysql>grant all privileges on *.* to 'replication'@'' identified by 'rep_password';

exit mysql on success,


Restart MySQL server.

You can check whether the master server is active by using the following command

mysql>show master status;

| File | Position  | Binlog_Do_DB             | Binlog_Ignore_DB |
| mysql-bin.000020 | 210                    | | mysql            |
1 row in set (0.00 sec)

We are all now set on the master server.

Slave server configuration

In slave configuration, my.cnf should be added with following entry,


It’s all you have to do in my.cnf file

Now restart the MySQL service.

After that enter into MySQL and perform the following commands

mysql>stop slave;


mysql>start slave;

Restart MySQL and use the following command to check the status of MySQL slave connection,

tailf /var/lib/mysql/[hostname].err

About Author

Howdy, I’m a System Administrator living in Ernakulam, India. I am a fan of technology, web development, and programming. I’m also interested in gaming and movies.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.