我们专注攀枝花网站设计 攀枝花网站制作 攀枝花网站建设
成都网站建设公司服务热线:400-028-6601

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

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转换表的存储引擎脚本
网站路径:http://mswzjz.cn/article/pggocg.html

其他资讯