Hi I want to migarate my server newly installed tokudb engine. i want to convert each table of database from innodb to tokudb. How can I do that using sed command ?
Asked
Active
Viewed 2,375 times
1 Answers
3
Instead of using sed, why not let mysql write the conversion script for you?
echo "SET SQL_LOG_BIN = 0;" > Convert_InnoDB_to_TokuDB.sql
MYSQL_USER=root
MYSQL_PASS=password
MYSQL_USERPASS="-u${MYSQL_USER} -p${MYSQL_PASS}"
MYSQL_PORT=3306
MYSQL_CONN="-h127.0.0.1 -P${MYSQL_PORT} ${MYSQL_USERPASS}"
SQLSTMT="SELECT CONCAT('ALTER TABLE ',table_schema,'.',"
SQLSTMT="${SQLSTMT} table_name,' ENGINE=TokuDB;') InnoDBConversionSQL"
SQLSTMT="${SQLSTMT} FROM information_schema.tables WHERE engine='InnoDB'"
SQLSTMT="${SQLSTMT} ORDER BY data_length"
MYSQL_OPTIONS="--skip-column-names -AN"
mysql ${MYSQL_CONN} ${MYSQL_OPTIONS} -e"${SQLSTMT}" >> Convert_InnoDB_to_TokuDB.sql
less Convert_InnoDB_to_TokuDB.sql
When you are satisfied with the conversion script, then run it
mysql ${MYSQL_CONN} ${MYSQL_OPTIONS} < Convert_InnoDB_to_TokuDB.sql
Give it a Try !!!
RolandoMySQLDBA
- 185,223
- 33
- 326
- 536