#!/bin/bash
if [ $# -ne 1 ]; then
echo "usage: convert.sh database"
exit 1
fi
date
db=$1
echo "Convert database $db" ;
mysql -B -N -e "SELECT TABLE_NAME, ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '$db' and engine='myisam'" |awk '{print $1}'| while read table; \
do \
echo "+ Converting Table $table"; \
mysql -B -N -e "alter table $table engine=innodb" $db; \
done;
最新评论