각종 팁&정보를 나누는 곳입니다.
누군가에게 도움이 된다 싶으시면 언제라도 포스팅 :)
글 등록하기 | 내글 관리하기 | 연재글 | 보관함
첨부파일 https://imweb.eond.com/webtip/430086

Changing a database table prefix is easy and here’s the simple step-by-step guide! For WordPress installations, it’s essential!


What you’ll need

  1. Use random.org to generate a strong table prefix
  2. Access to the database via cPanel or PHPMyAdmin
  3. A text editor
  4. 2 minutes

How to change a prefix

  1. In your text editor, change database_nameold_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;
  2. Run the query in cPanel or PHPMyAdmin on your WordPress database
  3. The output will be a series of SQL queries that will rename the tables for you
  4. Run the output
  5. Done!

How to add a prefix

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;

Conclusion

See how easy that was? Isn’t it great when articles just get straight to the point? :)

코멘트 0
접기/펴기 | 댓글 새로고침
 
 
Total 683 articles in 33 / 57 pages
번호 제목 제목 조회 수 날짜날짜
299 [웹로그] BlogAPI를 이용해서 제로보드XE에 글 올리기 11275 2007/11/18
298 [웹로그] Windows Live Writer 사용해보기 파일 [1] 5593 2007/11/18
297 [웹로그] 홈페이지나 블로그에 MSN 대화창 삽입하기 혹은 MSN 로그인 상태 보여주기 7516 2007/11/18
296 [웹로그] 문서파일에서 내용만 추출하기 - 한글 문서 추출 hwp 텍스트 변환 추출 8961 2007/11/18
295 [웹로그] 비밀글 웹 오피스 0 2007/11/18
294 [웹로그] 비밀글 파이어폭스에서 mp3 재생이 안될 때 0 2007/11/17
293 [웹로그] 구글 애드센스 컨설팅 - 하데스님의 블로그 구글 애드센스 최적화 가이드 편 파일 6838 2007/11/13
292 [웹로그] 비밀글 블로거뉴스단에 가입하라. 0 2007/11/13
291 [웹로그] 파이어폭스 추천 확장기능 파일 9469 2007/11/12
290 [웹로그] 알약 설치 후 - AYServiceNT.aye 라는 서비스는 왜 자동 시작되는 걸까? 파일 [3] [2] 11378 2007/11/12
289 [웹로그] ebs, 파이어폭스 지원은 안되겠니? 파일 [1] 7279 2007/11/12
288 [웹로그] 비밀글 한메일, 네이버, 지메일 간 POP 보내고 받기 0 2007/11/11

해시태그 디렉터리

오늘의 핫게시물