Difference between revisions of "MySQL Replication"

Line 1: Line 1:
 
== How to Set Up Replication ==
 
== How to Set Up Replication ==
 
For detailed instructions read the MySQL reference manual: http://dev.mysql.com/doc/refman/5.1/en/replication-howto.html '''The following instructions are provided for your convenience. We do not provide support for configuring replication on your MySQL server.'''
 
For detailed instructions read the MySQL reference manual: http://dev.mysql.com/doc/refman/5.1/en/replication-howto.html '''The following instructions are provided for your convenience. We do not provide support for configuring replication on your MySQL server.'''
 +
 +
=== Create User for Replication ===
 +
Execute these commands on your master mySQL server while logged in as root. Replace '''slaveuser''' and '''slavepass''' with the user and password that youwant to create. For increased security replace '''%''' with the IP of your MySQL slave.
 +
<source lang="mysql">CREATE USER 'slaveuser'@'%' IDENTIFIED BY 'slavepass';
 +
GRANT REPLICATION SLAVE ON *.* TO 'slaveuser'@'%';</source>
  
 
=== MySQL Master Configuration ===
 
=== MySQL Master Configuration ===

Revision as of 16:57, 19 February 2012

How to Set Up Replication

For detailed instructions read the MySQL reference manual: http://dev.mysql.com/doc/refman/5.1/en/replication-howto.html The following instructions are provided for your convenience. We do not provide support for configuring replication on your MySQL server.

Create User for Replication

Execute these commands on your master mySQL server while logged in as root. Replace slaveuser and slavepass with the user and password that youwant to create. For increased security replace % with the IP of your MySQL slave.

CREATE USER 'slaveuser'@'%' IDENTIFIED BY 'slavepass';
GRANT REPLICATION SLAVE ON *.* TO 'slaveuser'@'%';

MySQL Master Configuration

Add the following to your my.ini or my.cnf under [mysqld]. Then restart the MySQL service.

log-bin=mysql-bin
server-id=1
sync_binlog=1

MySQL Slave Configuration

Add the following to your my.ini or my.cnf under [mysqld]. Replace the values as needed. Then restart the MySQL service.

#each slave should have a unique id
server-id=2
#enter the name of the database that will be replicated
replicate-do-db=tcadmin2
#make the database read only to prevent accidental writing on the slave
read-only

Configuring TCAdmin

Retrieved from "https://help.tcadmin.com/index.php?title=MySQL_Replication&oldid=554"