WordPress.org

Ready to get started?Download WordPress

Forums

Acunetix WP Security
[Plugin: WP Security Scan] Table prefix renaming simplified (3 posts)

  1. scottsemple
    Member
    Posted 3 years ago #

    If a site owner would like to rename the standard wp_ prefix in their database for security reasons, I think there may be a simpler way than is usually prescribed.

    Is there any reason the following would not work?

    # Export the database;
    # Open the SQL file with a text editor;
    # Find and replace "wp_" with "newPrefix_";
    # Import the renamed SQL file into the database;
    # Edit the $table_prefix variable within wp-config.php from "wp_" to "newPrefix_";
    # Drop (delete) the old tables prefixed with "wp_".

    Any reason that wouldn't work?

  2. thowden
    Member
    Posted 3 years ago #

    Yes that does work. The only thing I would caution is that a global search and replace of wp_ will find entries within the tables which is not what we want.

    I used phpmyadmin to export the database and that used a single backtick around the table names. The backtick will not show here as it is used to flag code so I've used the normal quote for the example.
    'wp_tablename'

    Selecting the first backtick and the existing prefix 'wp_ and replacing it with 'newprefix_ will ignore the wp_ field entries and only select the table names.

    Depending on the tools you use this may require some variations but the basic export, change, import process will work.

    Of course on an active blog site you may want to block the site for the 10 minutes that this will take so that you do not lose any entries or comments.

    Tony

  3. q292u
    Member
    Posted 3 years ago #

    I used this plugin last week to rename my tables from wp_ to xx_.

    I then found that I was locked out of the wp-admin system entirely.
    Renaming the tables back to wp_ made no difference.

    The rename had also renamed all FIELDS within the tables starting with wp_ to XX_ !!
    So the wp-user-roles became xx-user-roles etc. Tables affected included wp-user and wp-user-meta..

    I've now MANUALLY corrected the mess. About two hours wasted.

    (Yes, I COULD have restored my current database backup, but then I'd have had to repopulate the posts from that backup onward. It's a dynamic site.)

    REALLY, NOT IMPRESSED.

    Advice to potential users of this plugin: DON'T BOTHER.

    Rename the tables manually.
    Update wp-config.php manually.

    Rename the admin user to something else.
    Make sure you have a backup admin user just in case.

    Make sure you have up-to-date backups..

    REALLY, NOT IMPRESSED.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic