1.Server environment Master:10.130.30.212 Slave:10.130.30.2142.Download MySQL Server and clIEnt packages MySQL-server-community-5.1.30-0.rhel5.x86_64.rpm MySQL-clIEnt-community-5.1.30-0.rhel5.x86_64.rpm 3.Install Master MySQL Server master# rpm -ivh MySQL-server-community-5.1.30-0.rhel5.x86_64.rpm MySQL-clIEnt-community-5.1.30-0.rhel5.x86_64.rpm master# MySQLadmin -u root passWord wlsun3.Configure Master MySQL Server master# mysql -u root -p MySQL> grant replication slave on *.* TO replication@"10.130.30.214" identifIEd by 'replication'; MySQL> exit master# cp /usr/share/MySQL/my-huge.cnf /etc/my.cnf master# vi /etc/my.cnf Under the master server [mysqld] heading add the following lines: log-bin=MySQL-bin binlog-ignore-db="mysql" Restart mysql service. master# service MySQL restart master# mysql -u root -p mysql> show master status; | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | | mysql-bin.000005 | 106 | | MySQL | 1 row in set (0.00 sec)4.Configure Slave MySQL Server slave# cp /usr/share/mysql/my-huge.cnf /etc/my.cnf slave# vi /etc/my.cnf Under the slave server [MySQLd] heading add the following lines: master-host = 10.130.30.212 master-user = replication master-passWord = replication master-port = 3306 Change : server-id = 1 to: server-id = 2 Restart Mysql Service slave# service mysql restart slave# MySQL -u root -p MySQL> STOP SLAVE; MySQL> CHANGE MASTER TO MASTER_HOST='10.130.30.212', MASTER_PORT=3306, MASTER_USER='replication', MASTER_PASSWord='replication', MASTER_LOG_FILE='MySQL-bin.000005', MASTER_LOG_POS=106; MySQL> START SLAVE; mysql> SHOW SLAVE STATUS\G5.Test Replication master# MySQL -u root -p MySQL> create database lingfeng; MySQL> use lingfeng; Database changed MySQL> show tables; Empty set (0.00 sec) MySQL> create table userid (id int); MySQL> insert into userid values(1),(2),(3),(4),(5); MySQL> exit Check the replication result on slave server slave# mysql -u root -p MySQL> use lingfeng; Database changed MySQL> select * from userid; | id | | 1 | | 2 | | 3 | | 4 | | 5 | 5 rows in set (0.00 sec)