上一篇已经说明了Mysql8的安装方法,这篇来说说主从怎么配置 一、配置修改 # 除去其他的,最关键的就是下面这些了,其实在上一篇里面已经设置好了 [mysqld3306] server_id=3306 binlog_fO
上一篇已经说明了Mysql8的安装方法,这篇来说说主从怎么配置
# 除去其他的,最关键的就是下面这些了,其实在上一篇里面已经设置好了
[mysqld3306]
server_id=3306
binlog_fORMat = mixed
log-bin = /mysql_data/data3306/mysql3306_bin
[mysqld3307]
server_id=3307
binlog_format = mixed
log-bin = /mysql_data/data3307/mysql3307_bin
1)确保 3306 与 3307 的Mysql是开启的,这里准备使用3306作为主,3307作为从
# 进入3306的Mysql,添加一个可以同步的账户
create user salve_1 IDENTIFIED BY "passWord-vvv";
grant replication slave on *.* to "salve_1"@"%";
2)show master statusG;
*************************** 1. row ***************************
File: mysql3306_bin.000007
Position: 156
change master to master_host="172.22.70.218", # 主IP
master_port=3307, # 主端口
master_user="slave_1", # 可以用来同步的用户
master_password="password-vvv", # 用户对应的密码
master_log_file="mysql3306_bin.000007", # 主上面的文件
master_log_pos=156; # 主上面对应的位置
注意:这里的ip地址不要填写127.0.0.1,其他的数据都是活的,请合理替换
# show slave statusG;
mysql> show slave statusG;
*************************** 1. row ***************************
Slave_IO_State:
Master_Host: 172.22.70.218
Master_User: slave_1
Master_Port: 3307
Connect_Retry: 60
Master_Log_File: mysql3306_bin.000007
Read_Master_Log_Pos: 156
Relay_Log_File: localhost-relay-bin.000001
Relay_Log_Pos: 4
Relay_Master_Log_File: mysql3306_bin.000007
Slave_IO_Running: No
Slave_SQL_Running: No
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 156
Relay_Log_Space: 156
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 0
Master_UUID:
Master_Info_File: mysql.slave_master_info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State:
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
Master_public_key_path:
Get_master_public_key: 0
Network_Namespace:
1 row in set (0.00 sec)
--结束END--
本文标题: 基于Linux上Mysql8主从设置
本文链接: https://lsjlt.com/news/6807.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-10-23
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0