I want to add a prefix and rename all tables in a database with PhpMyAdmin.
I’ve tried these 2 scripts :
1)
select concat('rename table', table_name, ' to ', 'prefix_',table_name,';') from information_schema.tables where table_schema='db_name';
2)
SELECT Concat('ALTER TABLE ', TABLE_NAME, ' RENAME TO osc_', TABLE_NAME, ';') FROM INFORMATION_SCHEMA.TABLES where table_schema='db_name';
phpMyAdmin says the script is ok (see screen shot) but nothing change. What i am missing with phpMyAdmin ?
Finally, i found an easy way to do that :
select all tables you want to add a prefix
choose in the select option : replace prefix table
fill the field with the prefix (including the underscore) as in pfx_
Screenshot of phpMyAdmin :
Note : In case your website is no more connected to your data base after this modification, you can restart your serveur, MAMP, etc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With