How to add prefix of all tables in mysql

前端 未结 4 1349
广开言路
广开言路 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:11

    To add to Rolando's excellent and comprehensive answer. If you run the RENAME queries generated by his SELECT CONCAT query (I used phpMyAdmin and just copied the output queries into the SQL box and hit Go) then you shouldn't have any problems with foreign key constraints. I've just done this on a test database in XAMPP and all tables renamed ok, and the constraints remained intact. This may seem obvious to SQL experts but perhaps not so much to us amateurs.

提交回复
热议问题