Windows MySQL multi-instance installation/master/slave copy/Reset password

Source: Internet
Author: User
Tags uuid

Windows creates multiple instances of MySQL

Installing MySQL and instance 1

    1. Run Mysql-installer-community-5.7.16.0.msi
    2. Select components
      1. MySQL Server 5.7.16–x64
      2. MySQL Utilities 1.6.4–x64
      3. MySQL Workbench 6.3.7–x64
      4. Performing the installation
      5. Configuring Port 3306
      6. Windows Service name is set to MySQL

Copy instance

    1. Copy C:\ProgramData\MySQL\MySQL to MYSQL1 and MYSQL2 folders
    2. Modify the My.ini in each folder
      1. Configure My.ini port number MYSQL1 to 3306, MYSQL2 to 3307
      2. The paths in the configuration My.ini are MYSQL1 and MYSQL2 corresponding paths
      3. Create a service
        1. Mysqld-install mysql1--defaults-file= "C:\ProgramData\MySQL\MySQL1\my.ini"
        2. Mysqld-install mysql2--defaults-file= "C:\ProgramData\MySQL\MySQL2\my.ini"
        3. Start the service
          1. net start MYSQL1
          2. net start MYSQL2

MySQL master/slave Configuration

The same USR accounts and passwords are used on the master and slave machines, and both replication slave and replication client permissions are given, which are used for data synchronization, which is used to monitor the slave synchronization state:

GRANT REPLICATION SLAVE, REPLICATION CLIENT on * * to [e-mail protected] ' 192.168.0.% ' identified by ' PWD ';

Dump/export the primary server data and then Import/restore from the data. If you use the export and import features of Workbench to note that the stored procedures and methods do not contain any scheme actions or are ignored, the corresponding SQL files need to be manually executed for creation.

Then perform the synchronization:

C:\Program files\mysql\mysql server\bin>mysqlreplicate--master=usr:[email protected]--slave=user:[email Protected]--rpl-user=usr:pwd

Errors and Solutions
    1. error:the slave ' s server_id is the same as the master.

Server_id=1 Modify the My.ini configuration of the primary server server_id=2

    1. Error:master must has binary logging turned on.

Enable binary logging in the My.ini configuration from the server

# Binary Logging.

# Log-bin

Log-bin=mysql-bin

    1. error:the slave ' s UUID is the same as the master.

Modify the Server-uuid in the auto.cnf file from the Server data folder

[Auto]

Server-uuid=b1a3dd23-edc7-11e6-81b8-480fcf275eaf

MySQL forgot root password
    1. Add skip-grant-tables and restart the MySQL service under My.ini configuration file [mysqld]
    2. Execute the following SQL

Use MySQL;

Update Mysql.user set Authentication_string=password (' Rootpassword ') where user= ' root ';

    1. Comment or delete skip-grant-tables in My.ini configuration file and restart the MySQL service

Windows MySQL multi-instance installation/master/slave copy/Reset password

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.