Master-slave replication keeps the data in sync from master to slave.
Master-slave MySQL servers are typically use master for writing data and slave for reading data so the changes that we make are reflected into slave serversin realtime. You can also use master for reading data while using slave for writing data to different tables. For more detail, please refer to here.
Please refer to MySQL Official Doc to set up MySQL replication.
- config your master, restart your master
- config your slave
- create user for replication
CREATE USER 'root'@'%' IDENTIFIED BY 'password'
GRANT REPLICATION SLAVE ON *.* TO 'root'@'%'- obtain master binary log coordinates using
SHOW MASTER STATUS - config your master in your slave using
CHANGE MASTER TO ...andSTART SLAVE
- export --
mysqldump - import --
mysql