Advertisement
Guest User

Untitled

a guest
Aug 11th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. use my_db;
  2. flush tables [list of MyISAM tables];
  3. lock each MyISAM table for read: `lock table <MyISAM table> read`
  4.  
  5. MYSQL_USER=root
  6. MYSQL_PASS=rootpassword
  7. MYSQL_CONN="-u${MYSQL_USER} -p${MYSQL_PASS}"
  8. CONVERT_SCRIPT=/tmp/ConvertMyISAMToInnoDB.sql
  9. echo "SET SQL_LOG_BIN = 0;" > ${CONVERT_SCRIPT}
  10. SQL="SELECT CONCAT('ALTER TABLE ',table_schema,'.',table_name,' ENGINE=InnoDB;')"
  11. SQL="${SQL} FROM information_schema.tables WHERE engine='MyISAM' AND"
  12. SQL="${SQL} table_schema NOT IN ('information_schema','mysql','performance_schema')"
  13. mysql ${MYSQL_CONN} -ANe"${SQL}" > ${CONVERT_SCRIPT}
  14. less ${CONVERT_SCRIPT}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement