mysql simple fragment cleanup script
#!/bin/bash
date=`date +"%Y-%m-%d %H:%M:%S"`
echo $date >>/root/qingli.log
tables=$ (/usr/local/mysql/bin/mysql -u root -p"tina" 2>/dev/null -e "select concat(table_schema,'.',table_name) from information_schema.tables where data_free>0 and engine ! ='MEMORY';" |grep -v "concat" |grep -v "tinatest" |grep -v "information_schema" |grep -v "mysql")
for table in $tables
do
/usr/local/mysql/bin/ mysql -u root-p"tina" 2>/dev/null -e "optimize no_write_to_binlog table $table;" >>/root/qingli.log doneAdd
no_write_to_binlog
to ensure that it is only executed on this main library, this command Do not pass it to the slave library, so as not to execute the slave library for too long and cause synchronization delay
mysql simple fragment cleanup script
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=326921740&siteId=291194637
Ranking