MySQL手册版本 5.0.20-MySQL同步(二)
6.4 设置同步
以下描述了如何快速设置MySQL同步服务器。假设你打算同步全部的数据库,并且之前没有设置过。需要关闭master服务器以完成全部的步骤。
本章描述的过程可以用于一个slave的情况,也可以用于多个slave的情况。
这只是一个最直接设置slave的办法,并不是只有一个。例如,已经有了master的数据快照(snapshot),master已经设置了服务器编号ID(server_id)并且启用了二进制日志,这就无需关闭master或者阻止在master上更新数据了。详情请看"6.9
Replication FAQ"。
想要完全掌握MySQL同步设置,最好把本章全部读完,并且测试在"14.6.1 SQL
Statements for Controlling Master Servers"和"14.6.2 SQL Statements for
Controlling Slave Servers"中提到的全部语句。而且要熟悉各种同步设置选项,详情请看"6.8 Replication Startup
Options"。
注意,这个过程以及后面一些同步SQL语句需要有 SUPER 权限。MySQL 4.0.2以前,则是
PROCESS 权限。
请确认master和slave上都安装了较近的MySQL版本,且这些版本之间要能兼容,在"6.5
Replication Compatibility Between MySQL
Versions"中列出来了。请确认在最新版本中还有存在问题,否则不要报告该bug。
在master上新加一个帐户,slave才能用它来连接。这个帐户必须授予 REPLICATION
SLAVE 权限。如果这个帐户只用于同步(推荐这么做),那就没必要授予其他权限了。设定你的域是 mydomain.com,想要授权一个帐户 repl 使用密码

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

AI Hentai Generator
Generate AI Hentai for free.

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

MySQL query performance can be optimized by building indexes that reduce lookup time from linear complexity to logarithmic complexity. Use PreparedStatements to prevent SQL injection and improve query performance. Limit query results and reduce the amount of data processed by the server. Optimize join queries, including using appropriate join types, creating indexes, and considering using subqueries. Analyze queries to identify bottlenecks; use caching to reduce database load; optimize PHP code to minimize overhead.

Backing up and restoring a MySQL database in PHP can be achieved by following these steps: Back up the database: Use the mysqldump command to dump the database into a SQL file. Restore database: Use the mysql command to restore the database from SQL files.

How to insert data into MySQL table? Connect to the database: Use mysqli to establish a connection to the database. Prepare the SQL query: Write an INSERT statement to specify the columns and values to be inserted. Execute query: Use the query() method to execute the insertion query. If successful, a confirmation message will be output.

One of the major changes introduced in MySQL 8.4 (the latest LTS release as of 2024) is that the "MySQL Native Password" plugin is no longer enabled by default. Further, MySQL 9.0 removes this plugin completely. This change affects PHP and other app

To use MySQL stored procedures in PHP: Use PDO or the MySQLi extension to connect to a MySQL database. Prepare the statement to call the stored procedure. Execute the stored procedure. Process the result set (if the stored procedure returns results). Close the database connection.

Creating a MySQL table using PHP requires the following steps: Connect to the database. Create the database if it does not exist. Select a database. Create table. Execute the query. Close the connection.

Many users are considering upgrading to the Windows 10 operating system. As Microsoft announced that it will no longer provide security updates and technical support for Windows 7. However, a considerable number of users still choose to stick to the Win7 system and look for office software suitable for this system. To help users improve office efficiency, this article will introduce several Office versions that are most suitable for Win7 systems. 1.Office2010: the perfect combination of stability and compatibility 2.Office2013: interface optimization and practical function upgrades 3.Office2016: new features of cross-platform collaboration and cloud storage 4.OfficeOnline: lightweight, free, online office anytime and anywhere 5 .WPSOffice:

Oracle database and MySQL are both databases based on the relational model, but Oracle is superior in terms of compatibility, scalability, data types and security; while MySQL focuses on speed and flexibility and is more suitable for small to medium-sized data sets. . ① Oracle provides a wide range of data types, ② provides advanced security features, ③ is suitable for enterprise-level applications; ① MySQL supports NoSQL data types, ② has fewer security measures, and ③ is suitable for small to medium-sized applications.
