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? :)
제목 | 날짜 | ||
---|---|---|---|
359 | [하드웨어] 컴퓨터 관련 포럼 [1] | 9493 | 2009/09/23 |
358 | [워드프로세서] 지정된 경로를 찾을 수 없습니다 | 16906 | 2009/10/10 |
357 | [하드웨어] 어머니 노트북 구매하기 | 9626 | 2009/10/18 |
356 | [하드웨어] 삭제되지 않는 Input Direct | 8048 | 2009/10/28 |
355 | [기본] 삭제되지 않는 Input Direct | 7371 | 2009/10/28 |
354 | [하드웨어] 지오 공유기 설정방법 | 14469 | 2009/10/30 |
353 | [기본] 지오 공유기 설정방법 | 12559 | 2009/10/30 |
352 | [하드웨어] USB가 고장났다. | 9512 | 2009/11/06 |
351 | [하드웨어] 웹캠(PC캠, 화상채팅 캠) 사기 [1] | 10038 | 2009/11/14 |
350 | [웹로그] 이온디 웹디벨로퍼 | 6250 | 2009/11/15 |
349 | [하드웨어] 컴퓨터 구매 목록 | 8894 | 2009/11/15 |
348 | [파일관리/압축] ExpressService.exe 삭제하기 | 16462 | 2009/11/16 |