MySQL – Master slave replication setup

to setup master – slave

ON MASTER SERVER

STEP #1 – set server ID

edit my.cnf and add

server-id=1

STEP #2 – Create slave user

mysql grant replication slave on *.* to ‘slave_username’@192.168.16.5 \  identified by ‘slave-password’;

 

STEP #3 – restart Mysql

service mysqld restart

 

ON SLAVE SERVER

STEP #4- Edit my.cnf file and add

server-id = 10
master-host = 192.168.1.1

master-user = slave_username

master-password = slave-password

replicate-ignore-db=mysql
replicate-wild-do-table=mydb.%

STEP #5 – set master host

#mysql -uroot -p

mysql >  slave stop; change master to master_host = ‘MASTER_IP’, master_user = ‘USERNAME’, master_password = ‘PASSWORD’ ;

STEP #6 – restart Mysql

Service mysqld restart

STEP #7 – slave start

slave start;

STEP #8 – check status

mysql:  show slave status\G

WP Twitter Auto Publish Powered By : XYZScripts.com