Friday, September 29, 2023

How to create MySQL replication server

 10.20.6.29 – Master Database

10.20.6.30 – Slave Database

pico /etc/mysql/mysql.conf.d/mysqld.cnf

chnage the bind address to your server real ip address 10.20.6.29

bind-address            = 127.0.0.1

uncomment

1Code language: JavaScript (javascript)

at the bottom of the file add your databases

binlog_do_db            = newdatabase
binlog_do_db            = newdatabase2
sudo service mysql restart

now log in with root on the mysql server via terminal

'slave_user'Code language: JavaScript (javascript)

copy the databases to the slave server with phpmyadmin
in 10.20.6.30 a.k. the slave

pico /etc/mysql/mysql.conf.d/mysqld.cnf
2Code language: JavaScript (javascript)
'10.20.6.29'Code language: JavaScript (javascript)
START SLAVE;
SHOW SLAVE STATUS\G

If there is an issue in connecting, you can try starting slave with a command to skip over it:

GLOBAL

No comments: