mysql 批量修复
程序员文章站
2024-02-22 11:42:22
#!/bin/bash
host_name=127.0.0.1
user_name=
user_pwd=
database=
need_optmize_t...
#!/bin/bash host_name=127.0.0.1 user_name= user_pwd= database= need_optmize_table=false tables=$(/usr/local/webserver/mysql/bin/mysql -h$host_name -u$user_name -p$user_pwd $database -a -bse "show tables") for table_name in $tables do check_result=$(/usr/local/webserver/mysql/bin/mysql -h$host_name -u$user_name -p$user_pwd $database -a -bse "check table $table_name" | awk '{ print $4 }') if [ "$check_result" = "ok" ] then echo "it's no need to repair table $table_name" else echo $(/usr/local/webserver/mysql/bin/mysql -h$host_name -u$user_name -p$user_pwd $database -a -bse "repair table $table_name") fi # ...,..... if [ $need_optmize_table = true ] then echo $(/usr/local/webserver/mysql/bin/mysql -h$host_name -u$user_name -p$user_pwd $database -a -bse "optimize table $table_name") fi done
上一篇: Android实现环形进度条的实例
推荐阅读
-
关于MySQL 优化的100个的建议
-
Windows环境下重置mysql密码操作命令
-
MySQL中用户授权以及删除授权的方法
-
Cannot load driver class: com.mysql.jdbc.Driver
-
mysql 批量修复
-
基于ubuntu中使用mysql实现opensips用户认证的解决方法
-
MySQL查询优化:LIMIT 1避免全表扫描提高查询效率
-
解析Mysql临时表及特点
-
java.lang.IllegalStateException: Cannot load driver class: com.mysql.jdbc.Driver
-
使用MySQL Slow Log来解决MySQL CPU占用高的问题