Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Mysql master-slave configuration

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

(1) prepare two hosts, the master server my.cnf is configured with log-bin=master-bin.log and server-id=1, the slave server server-id=1, and the cascade needs more log-slave-updates=1.

(2) on the main database, authorize an account for replication, and only grant super,replication slave permission

Mysql > grant super,replication slave on *. * to 'test'@'192.168.169.162' identified by' 123456'

Mysql > flush privileges

(3) print out the current binary log name and posvalue on the main database

Mysql > show master status

(4) configure the configuration of the connection master database on the slave database, specify the account / password used for replication, the ip, port, log file and pos location of the master server, etc.

Mysql > change master to-- configure the slave server to connect to the master

-> master_user='qy',-- the master server sets up a replicated account

-> master_password='111',-- password

-> master_host='192.168.169.161',-- Master server IP

-> master_port=3307,-- Port. Note: no quotation marks allowed.

-> master_log_file=' master-bin.000001',-- the file name found above by the host

-> master_log_pos=338;-- the location number found above

(5) after the configuration is completed, start the slave process from the database to make the Igamot O and SQL threads from the database effective

Mysql > start slave

(6) execute on the slave server at this time: show slave status\ G

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report