Changing a database table prefix is easy and here’s the simple step-by-step guide! For WordPress installations, it’s essential!
database_name
, old_prefix_
and new_prefix_
to the required values:SET @database = "database_name" ; SET @old_prefix = "old_prefix_" ; SET @new_prefix = "new_prefix_" ; SELECT concat( "RENAME TABLE " , TABLE_NAME, " TO " , replace(TABLE_NAME, @old_prefix, @new_prefix), ';' ) AS "SQL" FROM information_schema.TABLES WHERE TABLE_SCHEMA = @database; |
If your database doesn’t have a prefix at all, follow the steps above but use the below query that’s been slightly modified for this purpose:
SET @database = "database_name" ; SET @prefix = "prefix_" ; SELECT concat( "RENAME TABLE " , TABLE_NAME, " TO " , @prefix, TABLE_NAME, ';' ) AS "SQL" FROM information_schema.TABLES WHERE TABLE_SCHEMA = @database; |
See how easy that was? Isn’t it great when articles just get straight to the point? :)
제목 | 날짜 | ||
---|---|---|---|
347 | [하드웨어] 어머니 노트북 구매하기 | 9626 | 2009/10/18 |
346 | [하드웨어] 소켓 939 보드 구하기 | 9692 | 2009/09/21 |
345 | [웹로그] 애드센스 | 6377 | 2009/09/19 |
344 | [하드웨어] 컴퓨터 관련 포럼 [1] | 9493 | 2009/09/23 |
343 | [하드웨어] 컴퓨터 구매 목록 | 8894 | 2009/11/15 |
342 | [웹로그] eond.com 도메인 연장 이력 | 8107 | 2010/08/18 |
341 | [웹로그] 이온디 파비콘 만들기 | 6973 | 2009/09/11 |
340 | [하드웨어] 잉크 토너 구매 | 9524 | 2010/03/08 |
339 | [웹로그] 사이트바 디자인 모음 | 6952 | 2009/08/12 |
338 | [하드웨어] SD카드 복구하기 [1] | 16643 | 2009/08/04 |
337 | [웹로그] 내가 사용하는 프로그램 | 6789 | 2009/09/11 |
336 | [하드웨어] PC 구매하기 | 8494 | 2009/06/30 |