각종 팁&정보를 나누는 곳입니다.
누군가에게 도움이 된다 싶으시면 언제라도 포스팅 :)
글 등록하기 | 내글 관리하기 | 연재글 | 보관함
첨부파일 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 37 / 57 pages
번호 제목 제목 조회 수 날짜날짜
251 [웹로그] 파이어폭스 설치된 플러그인을 다른 컴퓨터에서도 사용하는 방법 5848 2007/10/27
250 [웹로그] 컴퓨터로 라디오 듣기 6409 2007/10/24
249 [웹로그] 탐색기 파일 목록 텍스트로 저장하기 [1] 8016 2007/10/23
248 [웹로그] 카스퍼스키 무료로 사용하기 6769 2007/10/23
247 [웹로그] 픽픽(PicPick) v1.7.2 Release 5032 2007/10/22
246 [데스크탑/액세서리] 무료 컴퓨터 화면 녹화 프로그램, 컴퓨터 화면 동영상으로 캡쳐 CamStudio 2.7 [7] [2] 9337 2007/10/22
245 [웹로그] 시작프로그램 관리 & 모니터링 5292 2007/10/21
244 [웹로그] 구글에서 mp3 다운받기 7672 2007/10/20
243 [웹로그] 어느 기하학자의 한글 창제 4972 2007/10/19
242 [웹로그] 비밀글 구글애드센스 광고형식 (작성중) 0 2007/10/19
241 [웹로그] 비밀글 파이어폭스 사용자 입맛에 고치기 0 2007/10/13
240 [웹로그] 요즘 사용하고 있는 위젯형식의 개인화페이지 6998 2007/10/11

해시태그 디렉터리