1. Adding a prefix to all tables in a MySQL database
SELECT Concat('ALTER TABLE ', TABLE_NAME, ' RENAME TO my_prefix_', TABLE_NAME, ';') FROM information_schema.tables WHERE table_schema = 'my_database'
출처 : https://steindom.com/articles/adding-prefix-all-tables-mysql-database
2.
SELECT
GROUP_CONCAT('RENAME TABLE `', TABLE_SCHEMA, '`.`', TABLE_NAME, '` TO `', TABLE_SCHEMA, '`.`prefix_', TABLE_NAME, '`;' SEPARATOR ' ')
FROM
`TABLES` WHERE `TABLE_SCHEMA` = "test";
참조
http://stackoverflow.com/questions/16339636/how-to-change-all-table-prefix-in-a-single-query
http://stackoverflow.com/questions/2466101/how-i-can-change-prefixes-in-all-tables-in-my-mysql-db
3. How to change a MySQL database’s table prefix
https://richjenks.com/change-mysql-database-table-prefix/
https://sir.kr/qa/145401
제목 | 날짜 | ||
---|---|---|---|
2 | [MySQL] MySQL/MariaDB 비밀번호 변경 | 611 | 2017/10/26 |
1 | [MySQL] mysql 접두어 변경하기 | 1346 | 2020/02/18 |