MySQL Mysql 프리픽스 수정하기

2017.03.15 17:46

이온디 조회 수:43

관련 URL 1  
관련 URL 2  
관련 URL 3  
관련 URL 4  
소스코드 https://sir.kr/qa/145401 

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