table of Contents
download
Blogger download the installation package is unpacked mysql version 8.0.16
Download
install service
Installation master Service
1, the new my.ini file in the bin directory
Follows
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
[mysqld]
#设置3306端口
port = 3306
# 设置mysql的安装目录
basedir=D:\\Mysql\\mysql-8.0.16-winx64-master
# 设置mysql数据库的数据的存放目录
datadir=D:\\Mysql\\mysql-8.0.16-winx64-master\\data
# 允许最大连接数
max_connections=200
# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
2, start the installation
1、>mysqld --initialize-insecure --console
2、>mysqld -install Mysql-master
3、>net start Mysql-master
4、>net stop Mysql-master
3, began landing
1、>mysql -uroot -p
2、>select host,user,authentication_string from mysql.user;
3、>ALTER user ‘root’@‘localhost’ IDENTIFIED BY ‘123456’;
4、>flush privileges;
5、>use mysql;
ALTER USER ‘root’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘123456’;
FLUSH PRIVILEGES;
6、>quit;
Slave installation services
1, the new my.ini file in the bin directory
Follows
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
[mysqld]
#设置3307端口
port = 3307
# 设置mysql的安装目录
basedir=D:\\Mysql\\mysql-8.0.16-winx64-slave
# 设置mysql数据库的数据的存放目录
datadir=D:\\Mysql\\mysql-8.0.16-winx64-slave\\data
# 允许最大连接数
max_connections=200
# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=MYISAM
2, start the installation
1、>mysqld --initialize-insecure --console
2、>mysqld -install Mysql-slave
3、>net start Mysql-slave
4、>net stop Mysql-slave
3, began landing
1、>mysql -uroot -p
2、>select host,user,authentication_string from mysql.user;
use mysql;
update user set authentication_string=’’ where user=‘root’;
3、>ALTER user ‘root’@‘localhost’ IDENTIFIED BY ‘123456’;
4、>flush privileges;
5、>use mysql;
ALTER USER ‘root’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘123456’;
FLUSH PRIVILEGES;
6、>quit;
Master-slave configuration
Owner:
Creating a read binlog from the library account password
0,> CREATE USER 'slave' @ 'localhost' IDENTIFIED WITH mysql_native_password BY 'slave';
given to read the file permissions
1,> Grant FILE ON . To 'root' @ 'localhost 'identified by' 123456 ';
privileges granted to the REPLICATION SLAVE
2,> the GRANT the ON REPLICATION SLAVE . the tO' Slave '@' localhost ';
refresh configuration
3,> flush privileges;
From:
Stop master-slave synchronization
0,> stop slave;
set the master node parameters on the (Slave) node
1,> change master to master_host = 'localhost', master_user = 'slave', master_password = 'slave', master_log_file = ' master-bin.000001-MySQL ', MASTER_LOG_POS = 1358;
Show Variables like' the server_id ';
sET Global the server_id = 2; # here as the line and the value set in my.cnf
view master-slave synchronization state
2,> show slave status \ G;
open master-slave synchronization
3,> start slave;
see master-slave synchronization state
. 4,> Show Slave status \ G;
Slave_IO_Running: Yes and Slave_SQL_Running: Yes, master-slave synchronization proved successful.
If the IO error
Show Variables like 'the server_id';
SET Global the server_id = 2; # here as the line and the value set in my.cnf
5,> show slave status \ G ;
error, then clean up may be configured
STOP Slave;
RESET All Slave ;
Get
Continuously updated in ...