How can I add prefix to all tables in mysql using query.
For example:
I need to add \"dr_\" in all tables which are available in mysql database.
Add a prefix to all of your database tables.
Supposing that your database was called "my_database" and the prefix you want to add is "my_prefix", execute the following query:
SELECT Concat('ALTER TABLE ', TABLE_NAME, ' RENAME TO my_prefix_', TABLE_NAME, ';') FROM information_schema.tables WHERE table_schema = 'my_database'
Your result set will be a bunch of queries that you can copy and paste into your favorite MySQL editor (Sequel Pro, phpMyAdmin, whatever). Just paste those in and execute, and you're all done.