1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#!/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
|
相关文章
- centOS下安装JDK1.8.60,glassfish4.1.1以及MySQL
- 关于流量升高导致TIME_WAIT增加,MySQL连接大量失败的问题
- 【原创】MySQL+MyEclipse+对象映射文件,schema与category的关系
- CentOS 6.5 zabbix 3.0.4 监控MySQL性能
- 查看mysql 服务器上的连接进程
- mysql中information_schema.columns字段说明
- MySQL 对比数据库表结构
- MySQL源码 information_schema新增表
- 3.数据库操作相关术语,Oracle认证,insert into,批量插入,update tablename set,delete和truncate的差别,sql文件导入
- MySQL中的information_schema数据库表说明