각종 팁&정보를 나누는 곳입니다.
누군가에게 도움이 된다 싶으시면 언제라도 포스팅 :)
글 등록하기 | 내글 관리하기 | 연재글 | 보관함
첨부파일 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 47 / 57 pages
번호 제목 제목 조회 수 날짜날짜
131 [브라우저] 파이어폭스로 EBS 로그인하기 [2] [4] 10360 2008/01/12
130 [기본] 플래시 시계 파일 [2] 7827 2007/12/10
129 [기본] SnagIt, Camtasia 무료 배포 7820 2007/12/04
128 [기본] 카스퍼스키 안티 바이러스 7, 3개월 무료 이용권 (처음 사용자용) 6199 2007/12/01
127 [기본] Bonjour Service 다시 한 번 알아보자. 파일 5633 2007/11/29
126 [기본] 판도라동영상 OpenAPI 사용후기 [1] 5962 2007/11/29
125 [브라우저] 왜임마 사용하기 #1 파일 [2] [1] 8559 2007/11/27
124 [기본] 웹페이지 동영상 주소 알아내기 파일 6547 2007/11/25
123 [기본] 마우스 제스처 어떻게 사용하시나요? 파일 5740 2007/11/25
122 [기본] 내 블로그에 Add to Diigo를 넣어보자 파일 [2] 6056 2007/11/25
121 [기본] 비밀글 구글 애드센스 계정의 정확한 수익 알기 3 2007/11/23
120 [기본] 비밀글 구글 검색창 소스 [1] 4 2007/11/23

해시태그 디렉터리