welcome: please sign in
location: MySQL

Setup master-master replication.

   1 flush tables with read lock;
   2 show master status;
   3 ; then dump master databases
   4 ; mysqldump -u root -p --all-databases | gzip > db-from-master.sql.gz
   5 unlock tables;

Create slave user:

   1 GRANT REPLICATION SLAVE ON *.* TO slave_user@'%' IDENTIFIED BY 'slavePassword';
   2 ; for MariaDB >= 10.4, use this for backward compatibility
   3 GRANT REPLICATION SLAVE ON *.* TO slave_user@'%' IDENTIFIED VIA mysql_native_password USING Password('slavePassword');

Set slave config:

   1 change master to master_host='10.0.0.1',master_user='slave_of_01',master_password='slavepass',master_log_file='mysql-bin.000002',master_log_pos=12345;
   2 start slave;
   3 show slave status\G

MySQL (last edited 2021-03-04 07:12:01 by AstroProfundis)

How many stars in your bowl, How many sorrows in your soul?
CopyRight © 2011-2021 Allen Zhong, under a CC BY-NC-ND 4.0 License.