mysql转换表的存储引擎脚本

vi convert_tbale_engine.sh
#!/bin/bash
DB=test
USER=root
PASSWORD=123456
HOST=192.168.1.10
MySQL_BIN=/usr/local/bin
S_ENGINE=MyISAM
D_ENGINE=InnoDB
$MYSQL_BIN/mysql -h$HOST -u$USER -p$PASSWORD $DB -s -e "select table_name from infomation_schem.table where table_schema='test' and engine='myisam'"|grep -v "table_name" >table.txt
for t_name in `cat table.txt`
do 
echo "Staring convert table $t_name..."
sleep 1
$MYSQL_BIN/mysql -h$HOST -u$USER -p$PASSWORD $DB -e "alter table $t_name engine=$D_ENGINE"
if [ $? -eq 0 ];then
echo "Convert table $t_name ended ">con_table.log
sleep 1
else
echo "Convert tbale $t_name failed ">con_table.log
fi
done

新闻名称:mysql转换表的存储引擎脚本
URL标题:http://lszwz.com/article/pggocg.html

其他资讯

售后响应及时

7×24小时客服热线

数据备份

更安全、更高效、更稳定

价格公道精准

项目经理精准报价不弄虚作假

合作无风险

重合同讲信誉,无效全额退款