手机
当前位置:查字典教程网 >编程开发 >mysql数据库 >mysql 批量修复
mysql 批量修复
摘要:#!/bin/bashhost_name=127.0.0.1user_name=user_pwd=database=need_optmize...

#!/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

【mysql 批量修复】相关文章:

mysql cmd常用命令

mysql的校对规则引起的问题分析

mysql 编码设置命令

mysql下修改engine引擎的方法

sql group by语法与实例

mysql 无限级分类实现思路

mysql grants小记

mysql sharding(碎片)介绍

mysql 数据库基础笔记

mysql 服务完全卸载技巧

精品推荐
分类导航