手机
当前位置:查字典教程网 >编程开发 >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 root用户的密码修改和消除

mysql 数据库基础笔记

mysql三种批量增加的性能分析

mysql 日期和时间函数

mysql sharding(碎片)介绍

mysql limit分页优化方法分享

mysql 查询重复的数据的SQL优化方案

mysql 常用数据库语句 小练习

mysql 存储过程的问题

mysql 优化日记

精品推荐
分类导航