I know how to run
RENAME TABLE onetable_test TO onetable;
But is there a method to rename many tables with a pattern and don\'t write a lot of
A slight modification on @ravnur's answer:
SET group_concat_max_len=5000;
SELECT group_concat(v.name separator '; ')
FROM (
SELECT concat('RENAME TABLE ', t.table_name, ' TO ', replace(t.table_name, 'wp_', 'blog_')) name
FROM information_schema.tables t
WHERE table_name like 'wp_%'
) v;
Useful when you want to rename your Wordpress tables from the default prefix of wp_
to blog_
(for example). Copy and paste the output of that command into the mysql shell or phpMyAdmin.