mysql master slave sync

mysql master =  192.168.0.10

vi /etc/my.cnf

#added for master sync
log-bin
server_id=1

CREATE USER ‘slaveuser’@’%’ IDENTIFIED BY ‘password’;
GRANT REPLICATION SLAVE ON *.* TO ‘slaveuser’@’%’;

FLUSH TABLES WITH READ LOCK;

mysqldump -A > alldb.sql

scp alldb.sql 192.168.0.11:/root

SHOW MASTER STATUS;

UNLOCK TABLES;

mysql slave = 192.168.0.11

mysql -u root < /root/alldb.sql

CHANGE MASTER TO
MASTER_HOST=’192.168.0.10′,
MASTER_USER=’slaveuser’,
MASTER_PASSWORD=’password’,
MASTER_PORT=3306,
MASTER_LOG_FILE=’mariadb-bin.000001′,
MASTER_LOG_POS=2024361,
MASTER_CONNECT_RETRY=10;

START SLAVE;

SHOW SLAVE STATUS \G