1、 show processlist,查看当前连接数,也可以看看有没有执行中的进程 2、 在从库上执行show slave status; 查看seconds_behind_maste的值,有数字表示有主从延时,这个值表示主从同步延时的时间 Seconds_Behind_Master: 32 如果未同步,在从库上执行下列操作: stop slave; #表示跳过一步错误,后面的数字可变 set global sql_slave_skip_counter =1; start slave;

show slave status;

报错信息:Coordinator stopped because there were error(s) in the worker(s). The most recent failure being: Worker 1 failed executing transaction 'ANONYMOUS' at master log mysql-bin.001045, end_log_pos 454708145. See error log and/or performance_schema.replication_applier_status_by_worker table for more details about this failure or others, if any.

报错是1032,没有找到要操作的记录,有时候会出这个报错,原因是开启了并行复制,先关闭并行复制 重启复制就可以了,然后再打开并行复制。

解决方法

stop slave; set global slave_parallel_workers=0; start slave; 恢复后,可以改回来或者保持不修改 stop slave; set global slave_parallel_workers=8; start slave;

磁盘告警删除binlog日志 查询binlog日志 mysql> show binary logs; 删除mysql-bin.000260之前的日志文件 mysql> purge binary logs to 'mysql-bin.000260';

二、MySQL创建用户、授权用户管理库 创建数据库 CREATE database leting-transfer2; 授权用户SELECT,INSERT,UPDATE权限ezr-transfer2管理数据库leting-transfer2 GRANT SELECT,INSERT,UPDATE,DELETE,EXECUTE,CREATE TEMPORARY TABLES ON leting-transfer2.* TO 'ezr-transfer2'@'%' identified by 'mK9VoirdLeWTArLj'; 创建eztemp用户: eztemp: GRANT SELECT,INSERT,UPDATE,DELETE,EXECUTE,CREATE TEMPORARY TABLES ON . TO 'eztemp'@'%' identified by 'PASSWORD'; 创建ezrbi用户 ezrbi: GRANT SELECT ON . TO 'ezrbi'@'%' identified by 'PASSWORD'; MySQL5.7忘记root密码: 在5.7版本中不存在password字段,所有要用以下修改进行重置密码 mysql>use mysql; mysql> update user set authentication_string=password('qwer1234') where user='root';
Query OK, 1 row affected, 1 warning (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 1 mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) MySQL5.7创建用户报错: 原因是MySQL5.6.6版本之后增加了密码强度验证插件validate_password,相关参数设置的较为严格。 使用了该插件会检查设置的密码是否符合当前设置的强度规则,若不满足则拒绝设置。影响的语句和函数有:create user,grant,set password,password(),old password。 提示需要修改密码;我们修改密码,他提示置的密码不符合当前设置的强度规。 mysql> select @@validate_password_policy;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. mysql> SET PASSWORD = PASSWORD('qwer1234'); ERROR 1819 (HY000): Your password does not satisfy the current policy requirements 解决: mysql> set global validate_password_policy=0;

MySQL忘记root密码 /usr/bin/mysqld_safe --skip-grant-table & update mysql.user set password=PASSWORD("qwer1234") where user='root';