MySQL Replication: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 36: | Line 36: | ||
# <tt>'''mysql> UNLOCK TABLES;'''</tt> | # <tt>'''mysql> UNLOCK TABLES;'''</tt> | ||
[[Category:Software]] | |||
[[Category:MySQL]] | [[Category:MySQL]] |
Revision as of 17:05, 21 February 2013
Open two windows to the Master Server and one window to the Slave Server
On the MASTER Server MAIN WINDOW
- # service mysqld stop
- # vi /data/chroot/etc/my.cnf
log-bin = mysql-bin server-id = 1
- # service mysqld start
On the SLAVE Server
- # service mysqld stop
- # vi /data/chroot/etc/my.cnf
server-id = 2
- service mysqld start
On the MASTER Server MAIN WINDOW
- # mysql -p -uroot
- mysql> GRANT REPLICATION SLAVE ON *.* TO 'mysql-ha'@'<IP Address of Slave>' IDENTIFIED BY '<Password>';
- mysql> FLUSH PRIVILEGES;
- mysql> FLUSH TABLES WITH READ LOCK;
On the MASTER Server SECOND WINDOW
- # mysql -p -uroot
- mysql> SHOW MASTER STATUS;
On the SLAVE Server
- # mysql -p -uroot
- mysql> CHANGE MASTER TO MASTER_HOST='<IP Address of Master>', MASTER_USER='mysql-ha', MASTER_PASSWORD='<Password>', MASTER_LOG_FILE='mysql-bin.000003', MASTER_LOG_POS=323;
- mysql> START SLAVE;
On the MASTER Server MAIN WINDOW
- mysql> UNLOCK TABLES;