1.mysql查看备库状态(OS命令行)
mysql -uroot -p'pass' -S /tmp/mysql3406.sock -e "show slave status \G" |egrep -i "Master_Host|Running"
2.分析binlog内容
mysqlbinlog --no-defaults -v -v --base64-output=DECODE-ROWS mysql-bin.005265 | grep -A '5265' 121829808
3.修改my.cnf中show_compatibility_56和slow_query_log参数
cp /etc/my.cnf /etc/my.cnf0525.bak
if [ $(grep -i "show_compatibility_56" /etc/my.cnf |wc -l) -eq 0 ]; then sed -i '/\[mysqld\]/a\\show_compatibility_56=1' /etc/my.cnf; fi
if [ $(grep -i "slow_query_log" /etc/my.cnf |wc -l) -eq 0 ]; then sed -i '/\[mysqld\]/a\\slow_query_log=on' /etc/my.cnf; fi
cat /etc/my.cnf |egrep -i "show_compatibility_56|slow_query_log"
4.重置用户user1密码为password123
echo 'password123' | passwd --stdin user_1