Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Kupası
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

Güvenliği Artırmak için WordPress Veritabanı Öneki Nasıl Değiştirilir?

Editoryal Not: WPBeginner üzerindeki ortak bağlantılardan komisyon kazanıyoruz. Komisyonlar, editörlerimizin görüşlerini veya değerlendirmelerini etkilemez. Editoryal Süreç hakkında daha fazla bilgi edinin.

Web siteniz için WordPress veritabanı önekini nasıl değiştireceğinizi mi merak ediyorsunuz?

Veritabanı önekini değiştirmek, web sitenizin verilerini SQL enjeksiyonlarına ve çevrimiçi bilgisayar korsanlarından gelen diğer saldırılara karşı koruyabilir. WordPress güvenliğini artırmaya yönelik önemli bir adım olabilir.

Bu eğitimde, güvenliği artırmak için WordPress veritabanı önekini nasıl değiştireceğinizi göstereceğiz.

How to change the WordPress database prefix

WordPress Veritabanı Önekini Neden Değiştirmelisiniz?

WordPress Veritabanı, tüm WordPress web siteniz için bir beyin gibidir çünkü her bir bilgi ve dosya burada saklanır.

Bu da veritabanını hacker’ların favori hedefi haline getirir. Spamcılar ve bilgisayar korsanları SQL enjeksiyonları için otomatik kodlar çalıştırabilir ve WordPress veritabanınıza girebilirler.

Ne yazık ki birçok kişi WordPress’i kurarken veritabanı önekini değiştirmeyi unutuyor. Bu da bilgisayar korsanlarının varsayılan wp_ önekini hedef alarak toplu bir saldırı planlamasını kolaylaştırıyor.

WordPress veritabanınızı korumanın en kolay yolu veritabanı önekini değiştirmektir, ki bunu kurmakta olduğunuz bir sitede yapmak gerçekten çok kolaydır.

WordPress veritabanı önekini kurulu siteniz için tamamen bozmadan düzgün bir şekilde değiştirmek birkaç ekstra adım gerektirir. Bununla birlikte, WordPress veritabanı ön ekinizi nasıl değiştireceğinizi ve WordPress güvenliğinizi nasıl artıracağınızı göstereceğiz.

Video Eğitimi

Subscribe to WPBeginner

Videoyu beğenmediyseniz veya daha fazla talimata ihtiyacınız varsa, okumaya devam edin.

WordPress Veritabanı Öneki Nasıl Değiştirilir

Bu eğitimde önerilen herhangi bir şeyi yapmadan önce WordPress veritabanınızı yedeklemenizi öneririz. Duplicator gibi bir eklenti kullanarak WordPress web sitenizin günlük yedeklerini tutmanız da önemlidir.

Ayrıca, veritabanı önekini değiştirirken ziyaretçilerinizi geçici bir bakım sayfasına yönlendirmenizi öneririz. Aksi takdirde, web sitenizin ziyaretçileri için kötü bir kullanıcı deneyimine neden olabilirsiniz.

wp-config.php’de Tablo Öneki Nasıl Değiştirilir

Öncelikle, WordPress hosting hesabınızdaki FTP veya Dosya Yöneticisi uygulamasını kullanarak web sitenize bağlanmanız gerekecektir.

Daha sonra WordPress kök dizininizde bulunan wp-config.php dosyanızı açmanız gerekir. Burada, tablo öneki satırını wp_ ‘den aşağıdaki gibi başka bir şeye değiştirebilirsiniz wp_a123456_

Yani hat şöyle görünecektir:

$table_prefix  = 'wp_a123456_';

Not: Tablo önekini yalnızca rakamlar, harfler ve alt çizgiler kullanarak değiştirebilirsiniz.

Tüm Veritabanı Tablo Adlarını Değiştirin

Ardından, phpMyAdmin aracını kullanarak veritabanınıza bağlanmanız gerekir. Eğer hostunuz cPanel panosunu kullanıyorsa, phpMyAdmin’i orada kolayca bulabilirsiniz.

Selecting phpMyAdmin on cPanel

Toplam 11 varsayılan WordPress tablosu vardır, bu nedenle bunları manuel olarak değiştirmek zahmetli olacaktır.

Bunun yerine, en üstteki ‘SQL’ sekmesine tıklamalısınız.

SQL query in phpMyAdmin

Ardından, aşağıdaki SQL sorgusunu girebilirsiniz:

RENAME table `wp_commentmeta` TO `wp_a123456_commentmeta`;
RENAME table `wp_comments` TO `wp_a123456_comments`;
RENAME table `wp_links` TO `wp_a123456_links`;
RENAME table `wp_options` TO `wp_a123456_options`;
RENAME table `wp_postmeta` TO `wp_a123456_postmeta`;
RENAME table `wp_posts` TO `wp_a123456_posts`;
RENAME table `wp_terms` TO `wp_a123456_terms`;
RENAME table `wp_termmeta` TO `wp_a123456_termmeta`;
RENAME table `wp_term_relationships` TO `wp_a123456_term_relationships`;
RENAME table `wp_term_taxonomy` TO `wp_a123456_term_taxonomy`;
RENAME table `wp_usermeta` TO `wp_a123456_usermeta`;
RENAME table `wp_users` TO `wp_a123456_users`;

Veritabanı önekini wp-config.php dosyasını düzenlerken seçtiğiniz önekle değiştirmeyi unutmayın.

WordPress veritabanına kendi tablolarını ekleyen diğer eklentiler için de satırlar eklemeniz gerekebilir. Buradaki fikir, tüm tablo öneklerini istediğinizle değiştirmenizdir.

Seçenekler Tablosu

Daha sonra seçenekler tablosunda önek olarak wp_ kullanan diğer alanları aramamız gerekir, böylece bunları değiştirebiliriz.

Süreci hızlandırmak için bu sorguyu kullanabilirsiniz:

SELECT * FROM `wp_a123456_options` WHERE `option_name` LIKE '%wp_%'

Bu çok sayıda sonuç döndürecektir ve bu satırları ve öneklerini değiştirmek için bunları tek tek gözden geçirmeniz gerekir.

UserMeta Tablosu

Daha sonra, önek olarak wp_ kullanan tüm alanlar için usermeta ‘da arama yapmamız gerekir, böylece onu değiştirebiliriz.

Bunun için bu SQL sorgusunu kullanabilirsiniz:

SELECT * FROM `wp_a123456_usermeta` WHERE `meta_key` LIKE '%wp_%'

Giriş sayısı, web sitenizde kaç tane WordPress eklentisi kullandığınıza bağlı olarak değişebilir. Sadece wp_ olan her şeyi yeni önekle değiştirin.

Artık sitenizi test etmeye hazırsınız. Yukarıdaki adımları izlediyseniz, her şey yolunda çalışıyor olmalıdır.

Güvenli tarafta olmak için veritabanınızın yeni bir yedeğini almanızı öneririz.

Umarız bu makale WordPress veritabanı ön ekini nasıl değiştireceğinizi öğrenmenize yardımcı olmuştur. WordPress veritabanınızı nasıl optimize ed eceğinize ilişkin kılavuzumuzu ve en iyi WordPress veritabanı eklentileri uzman seçimlerimizi de görmek isteyebilirsiniz.

Açıklama: İçeriğimiz okuyucu desteklidir. Bu, bazı bağlantılarımıza tıklarsanız komisyon kazanabileceğimiz anlamına gelir. WPBeginner'ın nasıl finanse edildiğini, neden önemli olduğunu ve nasıl destek olabileceğinizi görün. İşte editoryal sürecimiz.

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

Ultimate WordPress Araç Kiti

Araç setimize ÜCRETSİZ erişim sağlayın - her profesyonelin sahip olması gereken WordPress ile ilgili ürün ve kaynaklardan oluşan bir koleksiyon!

Reader Interactions

137 yorumBir Cevap Bırakın

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Dave van Hoorn says

    Update the SQL for renaming the prefixes please. WordPress adds the ‘wp_termmeta’ table now. It’s included in the SQL below.

    RENAME table `wp_commentmeta` TO `wp_yoursitename_commentmeta`;
    RENAME table `wp_comments` TO `wp_yoursitename_comments`;
    RENAME table `wp_links` TO `wp_yoursitename_links`;
    RENAME table `wp_options` TO `wp_yoursitename_options`;
    RENAME table `wp_postmeta` TO `wp_yoursitename_postmeta`;
    RENAME table `wp_posts` TO `wp_yoursitename_posts`;
    RENAME table `wp_termmeta` TO `wp_yoursitename_termmeta`;
    RENAME table `wp_terms` TO `wp_yoursitename_terms`;
    RENAME table `wp_term_relationships` TO `wp_yoursitename_term_relationships`;
    RENAME table `wp_term_taxonomy` TO `wp_yoursitename_term_taxonomy`;
    RENAME table `wp_usermeta` TO `wp_yoursitename_usermeta`;
    RENAME table `wp_users` TO `wp_yoursitename_users`;

  3. Prabhudatta Sahoo says

    When I am renaming my tables in the database all the images in the gallery are going away, I do not understand the reason. Could anyone please help me fixing this issue?

    • Terry Thorson says

      This issue will occur if you do not update the serialized data strings (used for your gallery images) correctly in the database. A good way to do this is to use the plugin WP Migrate DB. There is an excellent tutorial for this on Lynda.com (although be sure to use the same prefix for your target database as your source database).
      I learned this the hard way. Trying to start afresh, I discovered my backup was faulty as well. Luckily my webhost had an older backup I could use to restart my migration. WP Migrate DB did the trick.

  4. Cameron Jones says

    I can’t find any fields in the _usermeta or _options tables that would require updating. Unless they are specifically referencing a table, they shouldn’t need to be updated. It’s a table prefix, not a variable prefix.

    • Cameron Jones says

      Actually, I stand corrected. There are a couple that will be part of a default WordPress install:

      In prefix_options
      prefix_user_roles

      In prefix_usermeta
      prefix_capabilities
      prefix_user_level
      prefix_dashboard_quick_press_last_post_id
      prefix_user-settings
      prefix_user-settings-time

      You should be careful regarding updating any other fields. Plugins may either use the defined prefix or `wp_` as a prefix. Always make a backup and test on a dev or staging environment.

  5. kapil says

    hi,
    i have a query. assume that i have changed all my prefix from wp_something to some other name. these changes will be done to the existing fields in the database only. but wont the codes in my wordpress .php files remain the same??? so next time for any new user registration or some other registration, the entities will again be saved as wp_something as the main code in the .php files remains unchanged… ???

    thanks….

  6. tech says

    UPDATE `wp_a123456_options` SET `option_name`=REPLACE(`option_name`,’wp_’,’wp_a123456_’) WHERE `option_name` LIKE ‘%wp_%’;

    UPDATE `wp_a123456_usermeta` SET `meta_key`=REPLACE(`meta_key`,’wp_’,’wp_a123456_’) WHERE `meta_key` LIKE ‘%wp_%’;

    I do changes but after doing this i again run following query it shows prefix not changed
    SELECT * FROM `wp_a123456_options` WHERE `option_name` LIKE ‘%wp_%’

  7. Nathan WHite says

    This post and the responses to the comments leaves out a very important component. Does the table need to begin with wp_ ?

    Coming upon another discussion in wordpress.org indicated that it indeed did not need to. It would have helped me if this question was answered by the moderator.

    Also, dismissed_wp_pointers questions were not clearly answered. I changed mine.

  8. Clare Wood says

    Hi guys,

    I followed these steps, now when I try to see the back-end or front-end of my site I get this:

    ERROR: $table_prefix in wp-config.php can only contain numbers, letters, and underscores.

    I’m positive I only have lowercase letters and an underscore as my table prefix.

    Any ideas? The site is on localhost.

    Cheers.

  9. Thomas says

    Thanx a bunch! I tried to restore my old database, but to no avail. Then I figured out that my new database prefix was different from old. Made all that you recommended and vuala!

  10. Nikhil says

    I am getting this error…….”You do not have sufficient permissions to access this page” after implementing above procedure…..how to solve it?????

  11. Tom says

    Thanks for a great tips .
    I have a question.
    Do I need to change “wp_ ….” used in post_meta table as well?

  12. savagemike says

    For the wp_options and wp_usermeta tables, why not dump the database and use sed to replace “wp_” with the new prefix? Example:

    sed -i ‘s/wp_/wp_1234/g’ > filename.sql

    Then, simply import the modified dump. Easier and faster than changing cells one-by-one.

  13. gcreator says

    Attacker can simple use ‘%wp_%’
    I mean that is not fully secure at all…
    because he knows the table names that wordpress generates he can simply use ‘_%users’ for wp_anything_users OR ‘_%posts’ for ‘wp_anything_posts’ ..etc…

    • Jim says

      gcreator…

      For 99% of the attacks against WP databases, the skiddies are using pre-built tools and default settings. This gets you out of their crosshairs.

      if you are under focused attack then yeah, simple obfuscation will only slow them down, not completely protect you.

  14. gabe says

    I got syntax error when following this (my version of SQL is 5.5.x).

    I had success after referring to the SQL manual. Needed to leave the quotes out of the query:

    [WRONG] RENAME table ‘wp_links’ TO ‘wp_xx_links’;
    [RIGHT] RENAME TABLE wp_links TO wp_xx_links;

    • Sepster says

      You were using “standard” quotes ‘. The correct syntax to identify object names in mySql is to use “backquotes” ` (ie the key in the top left of a standard-US keyboard, left of the number 1)

    • Marcello Nuccio says

      The problem is that you are using the wrong quotes. You must use the backtick character around table names, not the apostrophe. In SQL, the apostrophe is used to delimit strings.

  15. Karen says

    I have changed the prefixes of a new install and then built a whole new site! I suddenly realised that I might not be able to update wordpress as normal from the admin panel..

    Does changing the prefixes affect being able to update wordpress as normal???

  16. Pablo says

    Nice.

    You can use this as well:
    UPDATE `wp_a123456_options` SET `option_name`=REPLACE(`option_name`,’wp_’,’wp_a123456_’) WHERE `option_name` LIKE ‘%wp_%’;

    UPDATE `wp_a123456_usermeta` SET `meta_key`=REPLACE(`meta_key`,’wp_’,’wp_a123456_’) WHERE `meta_key` LIKE ‘%wp_%’;

  17. Haary says

    Please answer ” How to create a plugin for take a backup of speific table in wordpress database?” in the stackoverflow

  18. Andrew Rickards says

    Thanks for the useful info. I just tried changing my DB prefix and everything seems to have worked perfectly.

  19. John says

    Thank you for doing the work to inform us on this topic. I have zero experience with WordPress, mySQL and PHP, so your help is greatly appreciated. A couple of questions:

    You have a graphic right below the words “There are a total of 11…”, with SQL circled. Am I supposed to check all the checkboxes?

    In the section titled “The Options Table”, which I’m getting to next, you say “This will return a lot of results, and you need to go one by one to change these lines.” How is this done (or will it be perfectly obvious)?

    • WPBeginner Support says

      John, you need to click on the SQL which will open a Text Area, copy and paste the query given below the circled screenshot into SQL textarea and click Go button.

      When updating options table you will run another SQL query to search for fields which have wp_ in them and replace those fields with your new database prefix. The query will return a number of rows you need to click on the Edit button next to each row to edit it and manually replace wp_ with your new database prefix.

      Yönetici

  20. Iftekhar says

    Dear writer, I have tested this in my local server. I am having problem to get access in my admin panel after changing table prefix. I have found “dismissed_wp_pointers” this in my database. Do I need to change it also?

    Thanks in advance

  21. Kobbe says

    Is this tutorial for an already installed blog…? Please kindly brief me on how to do this on a FRESH installations.

    • AMSGATOR says

      If you have already installed WordPress (regardless of how much you published) and you want to change the prefix then follow this tutorial.

  22. blurped says

    Great guide, works like a charm. One question- why did you leave ‘wp_’ in the new prefix? Seems like a whole lot of effort to change your table prefixes but still leave that fragment in there. Just remove it completely or replace it with something else more random (like ‘eh_’ or whatever)

  23. yerom says

    Well, everything is just fine… But when i’m go back to my site, it makes me the 5 minutes install again…
    I think i missed something.

    Anyone had the same issue ?
    Tks !

  24. ideal ismail says

    hi Admin,

    Regarding the naming convention for the table prefix, “Note: You can only change it to numbers, letters, and underscores. Feel free to mix uppercase and lowercase.”

    this is not true. You CAN’T use uppercase as it will wreak havoc with your database entries. i personally encountered this and the solution is to restrict to using numbers, underscores and lowercase letters.

    many other people have encountered this. a quick google search gave me the following:
    http://wordpress.org/support/topic/case-sensitive-wp_table_prefix?replies=1
    http://stackoverflow.com/questions/9827164/wordpress-keeps-redirecting-to-install-php-after-migration
    http://esdev.net/wordpress-error-you-do-not-have-sufficient-permissions-to-access-this-page/#.Ui_pHtJkMwB

    hope that helps.

  25. Steve says

    Couldn’t you just back everything up,
    export the DB to a DBbackup.sql file
    open it with a text editor.
    do a global search and replace and replace wp_ with mynewprefix_
    Save the file,
    drop all the tables in the DB
    and import the new DBbackup.sql?

      • Steve says

        Update – The global search and replace works. However, it might work too good. One of the side effects is that it returns all of your widgets to the default (fresh install) state.

        Luckily – it returns them to the “inactive section” so you don’t have to completely re-do them. My lesson learned was to take a screen shot of the dashboard (before) so it’s easier to remember where you had them all.

  26. Ahsan says

    Hey after changing table prefix and table name from mysql when i refresh the website it says website has a redirect loop, what should i do?

  27. Katie says

    Tried to do this on a multisite database install… totally failed. I seemed to put all the queries in correctly, but I got errors and at the end of all the steps my site was just redirecting itself indefinitely…

  28. Mark Pescatrice says

    Well after about 30 minutes of sweating bullets, I was able to do this. I made one tiny typo on wp-config.php. but otherwise it went smoothly. I did use Duplicator to create a backup before starting all of this.

    I recommend users to do the following additional steps:

    Before starting, put a dummy index.html in the root folder of your WP install, and renaming index.php to index.php.tmp (or something similar). After making a tiny typo in the wp-config.php file, I found myself at the WP install page.

    After you are done, rename index.php.tmp to index.php and remove or rename the index.html page.

    Thanks for the great article. I’m curious to see how the changes will affect the spam count.

    Mark Pescatrice

  29. Al Lemieux says

    In terms of process, do I make these security changes locally first? Or do I make them on WordPress?

  30. Corey says

    What about things like this? Do we need to change the wp in this, or only when it starts with wp?

    dismissed_wp_pointers

  31. Eric says

    Awesome information security for wp anti thief..But is there any free plugin or software to automate these processes?

  32. Orion says

    just tried this out, everything changed according to your instructions, hopefully this keeps the russians out….for a while at least.. Thank you for posting.

  33. Debra says

    I must be a total idiot because I sure can sort this out. Can’t even find the wp database. Geez this is frustrating

  34. Scott Semple says

    Successfully changed the database prefixes, but now I can’t sign in?

    My ##_capabilities in ##_usermeta is for an admin: a:1:{s:13:”administrator”;s:1:”1″;}

    Thoughts on why I still can’t sign in? Thanks!

  35. mckenzie says

    thanks so much! i searched all over the internet and you are the only blog entry to get this right on the spot!!

  36. Keith Davis says

    Hi Admin
    Good clear instructions but I’ve never had the confidence to attempt a database prefix change – just in case!

    You boys provide some great stuff – much appreciated.

  37. Leonco says

    Very interesting security steps…

    But surely there has to be a security plugin that addresses
    the issue of preventing hacking.

    • João says

      There are several plugins that do this, but the truth is that it’s always good to know how to do this yourself.

      For example I had an (apparently) buggy plugin change my WordPress database prefix just now, and i was locked out of my own WP installation.

      This simple guide showed me how to undo the damage.

Bir Cevap Bırakın

Yorum bırakmayı seçtiğiniz için teşekkür ederiz. Lütfen tüm yorumların yorum poli̇ti̇kasi uyarınca denetlendiğini ve e-posta adresinizin yayımlanmayacağını unutmayın. Ad alanında anahtar kelime KULLANMAYIN. Kişisel ve anlamlı bir sohbet edelim.