############################################# gtid故障处理开始 ############################################# # 模拟在从库删除库,然后再主库删除该库,报如下错误 # Last_SQL_Error: Error 'Can't drop database 'db1'; database doesn't exist' on query. Default database: 'db1'. Query: 'drop database db1' # Replicate_Ignore_Server_Ids: # Master_Server_Id: 623306 # Master_UUID: 11526eb0-fcbc-11e6-af7d-005056b937e2 # 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: 170227 15:44:06 # Master_SSL_Crl: # Master_SSL_Crlpath: # Retrieved_Gtid_Set: 11526eb0-fcbc-11e6-af7d-005056b937e2:1-2 # Executed_Gtid_Set: 11526eb0-fcbc-11e6-af7d-005056b937e2:1, # 1760a7a5-fcbc-11e6-8f14-005056b90358:1 # Auto_Position: 1 # Replicate_Rewrite_DB: # Channel_Name: # Master_TLS_Version: # # 处理方法: # stop slave; # set gtid_next='11526eb0-fcbc-11e6-af7d-005056b937e2:2'; # begin; # commit; # set gtid_next='automatic'; # start slave; # show slave status\G; ############################################# gtid故障处理结束 #############################################
四、配套卸载删除脚本[root@myserver mysql]# sh Uninstall_mysql.sh 请注意,你正在关闭mysqld服务!!! [Y/N]: Y 你已经选择关闭mysqld服务操作,即将关闭!!! 1 2 3 4 5 6 7 8 9 10 mysql卸载完毕... [root@myserver mysql]# chmod +x Uninstall_mysql.sh
cat Uninstall_mysql.sh #!/bin/bash mysqld_count=`ps -ef|grep -v 'grep' | grep mysqld |wc -l` echo " 请注意,你正在关闭mysqld服务!!!" function shutdown_and_delete_files () { if [ "${mysqld_count}" -eq 2 ]; then /usr/local/mysql/bin/mysqladmin --defaults-file=/gomeo2o/data/mysql/mysql_3306/my_3306.cnf --login-path=3306_localhost_login shutdown & fi # 模拟打印进度条 for i in {1..10} do echo -n " $i" sleep 1 done # 删除链接文件 if [ -L /usr/local/mysql ]; then unlink /usr/local/mysql fi echo "" # 删除相应的文件 rm -rf /opt/mysql/mysql-5.7.20-linux-glibc2.12-x86_64 rm -rf /etc/my.cnf.bak rm -rf /data/backup/* cp /root/.bashrc /root/.bashrc.bak cp /etc/rc.local /etc/rc.local.bak sed -i '/mysql.3306/d' /root/.bashrc sed -i '/mysql.3306/d' /etc/rc.local rm -rf /gomeo2o/data/* echo "mysql卸载完毕..." echo "" } read -p "[Y/N]: " answer case "${answer}" in Y|y|YES|yes) echo "你已经选择关闭mysqld服务操作,即将关闭!!!" shutdown_and_delete_files ;; N|n|NO|no) echo "你已经取消关闭mysqld服务操作..." ;; *) #echo "Error choice" echo "Useage: [Y|YES|y|yes N|NO|n|no]" ;; esac