In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains the "msyql master-slave backup process", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "msyql master-slave backup process"!
Installation environment:
Rhel6.5:server1 master
Rhel6.5:server2 slave
Install the database:
[root@server1 mysql] # yum install-y mysql-community-client-5.7.17-1.el6.x86_64.rpm mysql-community-common-5.7.17-1.el6.x86_64.rpm mysql-community-libs-5.7.17-1.el6.x86_64.rpm mysql-community-libs-compat-5.7.17-1.el6.x86_64.rpm mysql-community-server-5.7.17-1.el6.x86_64.rpm
[root@server1 ~] # vim / etc/my.cnf
Server-id = n assign a unique ID number to the server
[root@server1 ~] # / etc/init.d/mysqld start
Initialize MySQL database: [OK]
Installing validate password plugin: [OK]
Starting mysqld: [OK]
[root@server1 ~] # cd / var/lib/mysql
[root@server1 mysql] # cd / var/lib/mysql
[root@server1 mysql] # ls
Auto.cnf ibdata1 mysql-bin.000002 performance_schema
Ca-key.pem ib_logfile0 mysql-bin.000003 private_key.pem
Ca.pem ib_logfile1 mysql-bin.index public_key.pem
Client-cert.pem ibtmp1 mysqld_safe.pid server-cert.pem
Client-key.pem mysql mysql.sock server-key.pem
Ib_bufferpool mysql-bin.000001 mysql.sock.lock sys
[root@server1 mysql] # cat mysql-bin.000001
5.7.17-log [8
* * 4 / 4 / [root@server1 mysql] # ll mysql-bin.000001
-rw-r- 1 mysql mysql 177.28 14:40 mysql-bin.000001
Modify slave configuration file
Server-id = n assign a unique ID number to the server
[root@server1 mysql] # grep password / var/log/mysqld.log
View password
[root@server1 ~] # mysql_secure_installation
Initialization
Server2 ditto
Authorization on server1:
Mysql > grant replication slave on. To cara@'172.25.35.2' identified by 'Caonimei@478'
Query OK, 0 rows affected, 1 warning (0.02 sec)
Mysql > flush privileges; refresh
Query OK, 0 rows affected (0.02 sec)
After master authorization, slave can log in remotely
[root@server2] # mysql-ucara-p-h 172.25.35.1
Mysql > show databases
+-+
| | Database |
+-+
| | information_schema |
+-+
1 row in set (0.00 sec)
View the following on master:
Mysql > show master status
+-+
| | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set | |
+-+
| | mysql-bin.000004 | 843 |
+-+
1 row in set (0.00 sec)
Establish a connection between slave and master to synchronize:
Mysql > change master to master_host='172.25.35.1',master_user='cara',master_password='Caonimei@478',master_log_file='mysql-bin.000004',master_log_pos=843
View the following on slave:
Mysql > show databases
->
+-+
| | Database |
+-+
| | information_schema |
| | mysql |
| | performance_schema |
| | sys |
+-+
Mysql > change master to master_host='172.25.35.1',master_user='cara',master_password='Caonimei@478',master_log_file='mysql-bin.000004',master_log_pos=843
[root@server2 mysql] # cd / var/lib/mysql
[root@server2 mysql] # cat master.info
25mysql-bin.000004
eight hundred and forty three
172.25.35.1
Cara
Caonimei@478
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.