Home >Backend Development >PHP Tutorial >Teach you how to build a mysql mirror database under linux_PHP tutorial
MySQL Version: 4.1
Environment introduction: main library 192.168.0.205 slave library 192.168.0.206
1. Main library creation/ etc/my.cnf, modify the key value in [mysqld] and add
server-id=1
log-bin=binlog_name
2. Add users to the main database, Used to read the main library log from the library.
grant replication slave,reload,super on *.* to
'slave'@'192.168.0.206' identified by '123456'
3. Connect the slave library to the main library for testing .
/opt/mysql/bin/mysql -u slave -p -h 192.168.0.205
4. Stop the slave library, modify the slave library/etc/my.cnf, and add options: