SHOW TABLES command provides you with an option that allows you to filter the returned tables using the LIKE operator or an expression in the WHERE clause as follows:
START TRANSACTION SELECT*FROM x_tab WHERE id =2FORUPDATE; UPDATE x_tab SET amount = amount +5WHERE id =2; COMMIT
rename table
1
RENAME TABLE old_db.table TO new_db.table;
generate rename SQL
1 2
mysql -u username -ppassword old_db -sNe 'show tables' | while read table; \ do mysql -u username -ppassword -sNe "rename table old_db.$table to new_db.$table"; done