建立网站的目的,个人备案网站做企业网可以吗,wordpress 评论跳转,建站快车加盟以下步骤是真实的测试过程#xff0c;将其记录下来#xff0c;与大家共同学习。 一、环境说明#xff1a; 1、主数据库#xff1a; #xff08;1#xff09;操作系统#xff1a;安装在虚拟机中的CentOS Linux release 7.4.1708 (Core) [rootlocalhost ~]# cat /etc/redh…以下步骤是真实的测试过程将其记录下来与大家共同学习。 一、环境说明 1、主数据库 1操作系统安装在虚拟机中的CentOS Linux release 7.4.1708 (Core) [rootlocalhost ~]# cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core) 2数据库Mysql5.7.37 [rootlocalhost ~]# mysql -V
mysql Ver 14.14 Distrib 5.7.37, for linux-glibc2.12 (x86_64) using EditLine wrapper 2、从数据库 1操作系统Windows10 2数据库Mysql5.7.23 mysql select version();
------------
| version() |
------------
| 5.7.23-log |
------------ 二、主数据库master的修改 1、修改my.cnf #开启二进制日志
log-binmysql-bin
#设置server-id服务器唯一ID可取IP最后一段
server-id41
innodb_file_per_table1
# 不同步哪些数据库
binlog-ignore-db mysql
binlog-ignore-db information_schema
binlog-ignore-dbperformance_schema 2、重启mysql sevice mysqld restart 3、创建用于同步的用户账号授权异步复制REPLICATION权限(小心有可能不行啊) 本例中从数据库地址192.168.1.21如果是%表示任意地址在主数据库中创建用户名abc密码123的用户账号 mysql create user abc% identified by 123;
mysql grant replication slave on *.* to abc%;
mysql flush privileges; 4、查看master状态记录二进制文件名(File)和位置(Position)这里是mysql-bin.000001154 mysql show master status;
-------------------------------------------------------------------------
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
--------------------------------------------------------------------------
| mysql-bin.000001 | 154 | | mysql,information_schema,performance_schema | |
------------------------------------------------------------------------- 三、从数据库配置 1、my.ini配置 log-binmysql-bin
server-id21
slave-net-timeout60
replicate-ignore-dbmysql 2、重启mysql打开mysql会话执行同步SQL语句。注意标点符号语句中间是逗号结束是分号 CHANGE MASTER TO
MASTER_HOST192.168.1.41,
MASTER_USERabc,
MASTER_PASSWORD123,
MASTER_LOG_FILEmysql-bin.000001,
MASTER_LOG_POS154; 3、启动slave同步进程 mysql start slave;
Query OK, 0 rows affected (0.00 sec) 4、查看slave状态下面两项都是YES表示成功同步 mysql show slave status\G;
Slave_IO_Running: Yes
Slave_SQL_Running: Yes