각종 팁&정보를 나누는 곳입니다.
누군가에게 도움이 된다 싶으시면 언제라도 포스팅 :)
글 등록하기 | 내글 관리하기 | 연재글 | 보관함
첨부파일 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 38 / 57 pages
번호 제목 제목 조회 수 날짜날짜
239 [웹로그] 웹의 도덕적 교육의 필요성 5073 2007/10/11
238 [웹로그] 비밀글 싸이월드는 끝이 났다. 1 2007/10/11
237 [웹로그] 넷한글 인터넷 워드프로세서 7427 2007/10/10
236 [웹로그] 인터넷 한글 폰트 파일 [1] 6899 2007/10/10
235 [하드웨어] 메인보드 수리 보내기 [1] 7075 2007/10/08
234 [하드웨어] 고장난 컴퓨터 6625 2007/10/08
233 [웹로그] ImageShack 각종 편리한 툴 파일 4417 2007/10/08
232 [웹로그] 아토 1.8 (IE Toy 1.8 BETA2 patch1) 파일 [1] 5236 2007/10/08
231 [웹로그] 우리지역 도서관 이용해보자. 파일 6417 2007/10/07
230 [웹로그] IDtail, 왜 이래?! 파일 5755 2007/10/07
229 [하드웨어] 업어온 아버지의 PC 파일 6700 2007/10/07
228 [웹로그] 초보자 파이어폭스 사용하기 및 기본적인 추천플러그인 (작성 중 임시) 7903 2007/10/07

해시태그 디렉터리