In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article shows you how to achieve one-way synchronization in MySQL, the content is concise and easy to understand, it can definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
Instance CVM:
Dbasky=192.168.1.120
Dbaskyback=192.168.1.121
Purpose: the host of dbaskyback synchronizes the data on the test library of dbasky host.
Install mysql
[root@dbasky] # wget
[root@dbasky] # cd / usr/local/mysql-5.0.45
[root@dbasky] # groupadd mysql
[root@dbasky] # useradd-g mysql mysql
[root@dbasky] # mkdir / opt/mysql-data
[root@dbasky] # CFLAGS= "- O3" CXX=gcc CXXFLAGS= "- O3-felide-constructors
-fno-exceptions-fno-rtti ". / configure-- prefix=/usr/local/mysql-- enable-assembler-- with-charset=utf8-- with-extra-charsets=gbk,gb2312,latin1-- localstatedir=/opt/mysql-data-- with-mysqld-user=mysql-- enable-large-files-- with-big-tables-- without-debug-- enable-thread-safe-client-- with-fast-mutexes-- with-innodb
[root@dbasky] # make
[root@dbasky] # make install
[root@dbasky] # cd / etc
[root@dbasky] # rz my.cnf
[root@dbasky] # chown-R mysql.
[root@dbasky] # chgrp-R mysql.
[root@dbasky] # chown-R mysql / opt/mysql-data
[root@dbasky] # chgrp-R mysql / opt/mysql-data
[root@dbasky] # bin/mysql_install_db-- user=mysql
[root@dbasky] # chown-R root.
[root@dbasky] # bin/mysqld_safe-- user=mysql &
[root@dbasky] # cd / usr/local/mysql
[root@dbasky] # echo "PATH=/usr/local/mysql/bin:$PATH" > > / etc/profile
[root@dbasky] # echo "export PATH" > > / etc/profile
[root@dbasky] # echo "alias vi=" vim "> > / etc/profile
[root@dbasky] # echo "/ usr/local/mysql/lib/mysql" > / etc/ld.so.conf.d/mysql.conf
On the dbasky machine
Establish a user
Mysql > create database test
Mysql > grant all on *. * to identified by 123456
[root@dbasky] # vi / etc/my.cnf
Server-id=1 # is master
Log-bin=/var/log/mysql/mysql.log
Add
Binlog-do-db=test # name to be synchronized
Restart
Use mysql > show master status to view
On the dbaskyback machine
Dbaskyback#vi / etc/my.cnf
Server-id=2 # is slave
Master-host=192.168.1.120
Master-user=xu
Master-password=123456
Master-port=3306
Master-connect-retry=60 # reset every 60 seconds
Replicate-do-db=test
Use mysql > show slave status to see the synchronization, and you can see if there are any errors.
The above is how to achieve one-way synchronization in MySQL. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
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.