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? :)
제목 | 날짜 | ||
---|---|---|---|
335 | [하드웨어] CPU 이야기 | 7227 | 2009/06/27 |
334 | [하드웨어] 휴대용 스피커 구매 : Kalon KS-18 | 8142 | 2009/06/27 |
333 | [하드웨어] 노트북 복구기 | 8516 | 2009/06/16 |
332 | [하드웨어] c0000139 unknown error | 9449 | 2009/06/16 |
331 | [하드웨어] 햅틱팝 배경만들기 | 8895 | 2009/06/08 |
330 | [하드웨어] 햅틱팝 컴퓨터에 연결하기 | 10625 | 2009/06/08 |
329 | [하드웨어] V840 컴퓨터와 연결하기 | 7879 | 2009/05/17 |
328 | [하드웨어] 아이락스 키보드 구매기 | 7838 | 2009/05/10 |
327 | [웹로그] UCC 사이트 | 5842 | 2009/04/06 |
326 | [하드웨어] 하드 관리 | 9061 | 2009/03/28 |
325 | [하드웨어] 하드 구매 | 8666 | 2009/03/25 |
324 | [웹로그] 미니홈피가 좋은 이유 | 5934 | 2009/03/15 |