mysql replication

Spread the love
Create Replication User 
REPLICATION SLAVE privilege: 
#mysql -uroot -p
#CREATE USER ‘user_vishal’@’localhost’ IDENTIFIED BY ‘pass_123’;
#GRANT REPLICATION SLAVE ON *.* TO ‘user_vishal’@’Slave Ip Addd’ IDENTIFIED BY ‘pass_123’;
#mysql>FLUSH PRIVILEGES;
#show master statusG;

In master server:-

vim /etc/my.cnf
log-bin=mysql-bin
server-id=1
innodb_flush_log_at_trx_commit=1
sync_binlog=1

Restart MySQl

On Slave Server:-
vim /etc/my.cnf

server-id=2
master_host=(master ip)
master_user=vyas
master_password=123

Restart MySQl
#mysql -uroot -p
CHANGE MASTER TO MASTER_HOST=’Master Host’,
MASTER_HOST=’X.X.X.X’,
MASTER_USER=’user’,
MASTER_PASSWORD=’password’,
MASTER_PORT=3306,
MASTER_LOG_FILE=’mysql-bin.000001?,
MASTER_LOG_POS=98,
MASTER_CONNECT_RETRY=10;

START SLAVE;

SHOW SLAVE STATUSG;

Thanks,
Vishal Vyas
Linuxguru
See also  Creating custom SSH welcome messages

Leave a Comment