Jump to content

MySQL Master/Slave Replication

From MattWiki

mySQL replication how-to.

On The Master mySQL server[edit | edit source]

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[edit | edit source]

[mysqld]
server-id=2

Notes[edit | edit source]