This article explores the opportunity of a Master-Slave replication on MySQL 8. The underlying OS is FreeBSD 13.
On the Master server install and start the MySQL service. Log into MySQL as root and perform following steps:
create user 'replicate'@'%' identified with mysql_native_password by 'tryhackme';
grant replication slave, replication client on *.* to 'replicate'@'%';
flush privileges;
Log out and edit my.cnf
file under /usr/local/etc/mysql/
and add following line under [mysqld]
:
server-id=1
Make sure MySQL service is running in master server. Now move to Slave server, and do the following in MySQL console:
create user 'replicate'@'%' identified with mysql_native_password by 'tryhackme';
grant replication slave, replication client on *.* to 'replicate'@'%'
Exit from the console, go to my.cnf
and add the following line under [mysqld]
:
server-id=2
Now login to Slave MySQL console again and enter the following lines:
change master master_host="<MASTER_HOSTIP>", master_user="replicate", master_password="tryhackme";
Once you are done with above, go back to Master and create a database. Once you have created, go back to Slave MySQL console and start the slave process:
start slave;
You will see that the database created in Master replicated in Slave.
Reference:
https://nixmicrosoft.wordpress.com/2011/11/13/configure-mysql-replication-in-freebsd/
https://dba.stackexchange.com/questions/202933/slave-mysql-configuration-is-not-stored