1. Environment introduction and explanation
The operating system where the main library is located: win7
Version of the main library: mysql-5.7.17-winx64.zip
The ip address of the main library: 127.0.0.1
Main library port: 3307
The operating system where the slave library is located: win7
Version from library: mysql-5.7.17-winx64.zip
The ip address of the slave library: 127.0.0.1
Port from library: 3308
Second, the installation of the Master database
1: The unzipped directory is as follows
2: Enter the mysql-Master directory, and then create a new my.ini file in this directory and add the following content.
[client]
port=3307
default-character-set=utf8
[mysqld]
server-id=66 #服务器id不固定,整数即可
#端口
port=3307
character_set_server=utf8
#解压目录
basedir=D:\MySQL\mysql-Master
#解压目录下data目录
datadir=D:\MySQL\mysql-Master\data
log-bin=master-bin #同步日志的文件存放路径
log_bin-index=master-bin.index
binlog-do-db=user #备份哪些些数据库的二进制日志
#binlog-ignore-db=... #也可以直接设置哪些数据库不同步
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
3: Enter cmd as an administrator, and then enter the D:\MySQL\mysql-Master\bin directory, as shown below
4: Initialize the database (the arrow points to the password for logging in to mysql, which will be used in the following operations)
mysqld --initialize --user=mysql --console
5: Install mysql, then start mysql
mysqld --install master --defaults-file="D:\MySQL\mysql-Master\my.ini"
net start master
6: Log in to mysql (the password is indicated by the arrow above)
mysql -u root -p
7: Modify the password of mysql
set password for root@localhost=password('root');