Mysql Master Slave Config

Source: Internet
Author: User

Installation of two or more MySQL services on the same machine:

Download the MySQL installation package, install the installation folder after the completion of the installation of multiple copies on the disk, respectively into the My.ini modify port (ports can not conflict), Server_id,basedir (optional), DataDir (data file path) and other parameters;

# Path to the database root
datadir= "D:/mysql/mysql Server 5.7/data/"

# General and Slow logging.
Log-output=file
general-log=1
general_log_file= "Vipsh-20140721i.log"
slow-query-log=1
Slow_query_ Log_file= "Vipsh-20140721i-slow.log"
long_query_time=2

# Binary Logging.
# Log-bin
server_id           =
Log_bin             = d:/m Ysql/mysql server 5.7/data/ericsun-mysql-bin.log
Log_bin_index       = D:/mysql/mysql Server 5.7/data /ericsun-mysql-bin.index
max_binlog_size     = 256M
expire_logs_days    =

#===== From the server you need to configure =====
Relay_log = Ericsun-mysql-relay-bin
log_slave_updates< Span style= "White-space:pre" > = 1
read_only = 1


# Error Logging.
Log-error= "Vipsh-20140721i.err"

Note: You must delete auto.cnf when copying the installation folder, otherwise you will get an error when starting slave: Fatal error:the slave I/O thread stops because master and slave has equal MySQL server UUIDs; These uuids must be di Fferent for replication to work.

After completion, the CMD input command installs the Windows Service service: mysqld--install mysqlxy--defaults-file= "C:\Program files\mysql\mysql Server x.y\ My.ini "

After the installation is successful, different MySQL services are launched separately;

Log in to different MySQL instances, enter show Master Status\g, view the status of the primary server, enter show slave status\g, view the status from the server;

Then set from the Server CMD window: Change master to master_host= ' localhost ', master_user= ' root ', master_password= ' root ', master_log_file = ' mysql-bin.000001 ', master_log_pos= ' 0 ';

Then enter show slave status\g again; View

Slave_io_running:yes
Slave_sql_running:yes

The background thread runs yes.

Crud at this time on the main library, updated from the library


Mysql Master Slave Config

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.