Configuring MySQL replication error logging

Source: Internet
Author: User

The following applies to the [MYSQLD] paragraph


  1. Server-id= 1 This line must be, 1 can be other numbers, generally recommended is the IP last segment.

  2. Log-bin=mysql-bin must have this, to turn on Binlog binary required.

  3. Binlog-do-db=abc Optional, only synchronize the ABC database, with, number separated, you can synchronize multiple databases. Binlog-do-db write error causes Mysqld to fail to start, prompting for a PID file not found.

  4. BINLOG-IGNORE-DB=ABC is optional and synchronizes databases other than ABC.

  5. When configuring two mysqld on the same machine, when starting the second mysqld, run in the corresponding MySQL directory: Bin/mysqld_safe & can start successfully, start in Bin directory will fail, run in directory: Bin./mysqld_safe-- Defaults-file=. /MY.CNF--user=mysql & will fail, the MY.CNF configuration file cannot be loaded.

  6. Start the second Mysqld method: Mysql-s/data/mysql2.sock-p123456 # Mysql-s The path of the second MySQL sock, password 123456

  7. Close the second Mysqld method:

    A. First find out the pid:ps of the second mysqld aux|grep 3307 #第二个mysqld我配置的端口为 3307


    [[Email protected] ~]# PS Aux|grep 3307

    MySQL 6136 0.0 71.2 1011252 352200 pts/0 Sl 13:55 0:03/soft/mysql/bin/mysqld--basedir=/soft/mysql--datadir=/d Ata/mysql--plugin-dir=/soft/mysql/lib/plugin--user=mysql--log-error=/data/mysql/kaka.err--pid-file=/data/mysql /kaka.pid--socket=/tmp/mysql.sock--port=3307

B. Kill 6136 #不能用kill-9 6136 to avoid loss of database data


8. When initializing the second MySQL database, the prompt does not have a my-default.cnf.

Cp/etc/my.cnf/soft/mysql2/support-files/my-default.cnf

VI/SOFT/MYSQL2/SUPPORT-FILES/MY-DEFAULT.CNF modifying the correct path and port for MYSQL2

9. Set Slave

A. Modify the my.cnf file, delete the line server-id=, or change to another, not the same as master.

B. Based on the configuration of master, add rows:

REPLICATE-DO-DB=ABC #同步数据库abc

#replicate-IGNORE-DB=ABC #同步除了abc以外的数据库


Configuring MySQL replication error logging

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.