Operation details based on MySQLMasterSlave synchronization configuration _ MySQL
Source: Internet
Author: User
BitsCN.com Environment: PC: ubuntu 10.10 192.168.1.112 (master) 192.168.10.245 (slave)
MySQL: 5.1.49-1ubuntu8. 1-log
The database test already exists in the master.
First modify the mysql configuration file:/etc/mysql/my. cnf [Master]
# Author: zhxia
Server-id = 2
Replicate-do-db = test
Replicate-do-db = blog
Log_bin =/var/log/mysql/mysql-bin.log
Relay_log =/var/log/mysql/mysql-relay-bin.log
Expire_logs_days = 10
Max_binlog_size = 100 M
# Binlog_do_db = test
# Binlog_ignore_db = include_database_name
Binlog_format = mixed
Slave-net-timeout = 6012 master-connect-retry = 10
Create a backup account on the master
Grant replication slave, replication client on *. * to 'Slave '@ '192. 168.10.245 'identified by '123 ';
Import the database in the master to slave,
First lock the table and prohibit write operations
Flush tables with read lock;
Export from the master: mysqldump-uroot-p test>/tmp/test. SQL
Import it to slave: mysql-uroot-p test </tmp/test. SQL. remember to create a database named test first.
Go to mysql on the master and check the master status.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service