How to add prefix of all tables in mysql

前端 未结 4 1308
广开言路
广开言路 2021-01-31 11:32

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.

4条回答
  •  梦如初夏
    2021-01-31 12:13

    Run all queries that you get from running this query:

    SELECT Concat('ALTER TABLE `', TABLE_NAME, '` RENAME TO `dr_', TABLE_NAME, '`;') FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = '';
    

提交回复
热议问题