MYSQL5 masterslave数据同步配置方法第1/3页
因线路或安全需要我们不得不考虑mysql的备份,特把mysql数据备份的方法整理下。
测试环境.基本上数据是瞬间同步,希望对大家有帮助
RedHat ES 3 update 3
MYSQL 5.0.15
MYSQL数据同步备份
A服务器: 192.168.1.2 主服务器master
B服务器: 192.168.1.3 副服务器slave
A服务器设置
#mysql –u root –p
mysql>GRANT FILE ON *.* TO backup@192.168.1.3 IDENTIFIED BY ‘1234';
mysql>exit
上面是Master开放一个账号backup密码1234给IP:192.168.1.3有档案处理的权限
mysqladmin –u root –p shutdown
导出Master的数据库到slave的机器,可以选择导出需要同步的数据库
在A机器上修改/etc/my.cnf
在[mysqld]区段内加入参数
log-bin=mysql-bin
server-id=1
binlog_do_db = gbbbs(要同步的数据库)
binlog_ignore_db = mysql,test,information_schema (不需要同步的库,5.0 有information_schema这个库)
sql-bin-update-same
重启A服务器mysql
B服务器设置
设定/etc/my.cnf
在[mysqld]区段加入
server-id = 2 (如果还有slave用户,他们的ID也随之增加,如server-id=3)
master-host = 192.168.112.71
master-user = backup
master-password = 1234
replicate-do-db = gbbbs
#replicate-do-db = database2
log-warnings
master-port=3306
master-connect-retry = 60
重启B服务器的MYSQL
在数据库的文件夹里有master.info文件,用来查看同步信息
其实就是MYSQL Replication

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How to implement synchronous and asynchronous data processing functions in PHP. With the continuous development of the Internet, real-time updating of web pages and asynchronous processing of data have become more and more important. As a popular back-end development language, PHP also needs to be able to handle synchronous and asynchronous requests for data. This article will introduce how to implement synchronous and asynchronous data processing functions in PHP and provide specific code examples. 1. Synchronous processing of data Synchronous processing of data means that after the request is sent, wait for the server to complete processing and return the data before continuing to the next step. The following is

PHP and SOAP: How to implement synchronous and asynchronous processing of data Introduction: In modern web applications, synchronous and asynchronous processing of data are becoming more and more important. Synchronous processing refers to processing only one request at a time and waiting for the completion of the request before processing the next request; asynchronous processing refers to processing multiple requests at the same time without waiting for the completion of a certain request. In this article, we will introduce how to use PHP and SOAP to achieve synchronous and asynchronous processing of data. 1. Introduction to SOAP SOAP (SimpleObject

How to implement data replication and data synchronization in distributed systems in Java. With the rise of distributed systems, data replication and data synchronization have become important means to ensure data consistency and reliability. In Java, we can use some common frameworks and technologies to implement data replication and data synchronization in distributed systems. This article will introduce in detail how to use Java to implement data replication and data synchronization in distributed systems, and give specific code examples. 1. Data replication Data replication is the process of copying data from one node to another node.

With the development of Internet applications and the continuous updating of adopted technologies, data replication and synchronization have become increasingly necessary functions for many systems. In the Golang language, many people hope to use the MySQL database for data replication and synchronization. This article will introduce how to use MySQL to achieve data replication and synchronization in the Go language. Determine the requirements for replication and synchronization Before starting to implement data replication and synchronization, we need to first determine the requirements for data replication and synchronization. For example, we need to know which tables require data

How to use Redis to achieve distributed data synchronization With the development of Internet technology and the increasingly complex application scenarios, the concept of distributed systems is increasingly widely adopted. In distributed systems, data synchronization is an important issue. As a high-performance in-memory database, Redis can not only be used to store data, but can also be used to achieve distributed data synchronization. For distributed data synchronization, there are generally two common modes: publish/subscribe (Publish/Subscribe) mode and master-slave replication (Master-slave).

MySQL is a very popular relational database management system with good performance and stability. It is a database software widely used by many enterprises and organizations. In MySQL, data replication is a very important feature, which allows data to be synchronized between multiple database servers to ensure data security and reliability. Mirroring techniques for setting up MySQL data replication is the topic of this article. The basic concept of MySQL data replication. In MySQL, data replication refers to copying data in a MySQL instance.

As the amount of data continues to increase, data management and backup have become increasingly important. In modern Internet applications, using the Gin framework to implement data synchronization and backup functions has become an important part. The Gin framework is a lightweight Go language web framework that adopts the MVC (Model-View-Controller) design pattern and aims to simplify the development of web applications. Web applications developed using the Gin framework can handle HTTP requests and responses quickly and efficiently, and are highly scalable and scalable.

How to use PHP database connection to achieve data synchronization and replication In many web applications, data synchronization and replication are very important. For example, when you have multiple database servers, you may want to ensure that the data on these servers is kept in sync so that users always get the latest data when they access your application. Fortunately, using PHP database connections, you can easily synchronize and replicate your data. This article will introduce the steps to use PHP database connection to achieve data synchronization and replication, and provide corresponding code examples for
