MySQL Master/Slave Replication

From MattWiki
Jump to: navigation, search

mySQL replication how-to.

On The Master mySQL server

Add the following to your my.cnf file usually located in your /etc/ directory.

[mysqld]
log-bin=mysql-bin
server-id=1

Then restart the mySQL server.

/sbin/service mysqld restart

Now setup the user for replication

CREATE USER 'repl'@'%.mattrude.com' IDENTIFIED BY 'slavepass';
GRANT REPLICATION SLAVE ON *.* TO 'repl'@'%.mattrude.com';
UNLOCK TABLES;

On The Slave mySQL server

[mysqld]
server-id=2

Notes