How To Rename WordPress Database Name And User Name

Rename default WordPress Database Name and Database user name one of the important security steps. If you follow WordPress auto installation method such as fantastico method, it will generate default names for database name and user. As a result of that anyone can easily guess it. However with the help of cPanel PHPMyAdmin we can easily rename them. This method will not wipe anything on your site.

After renamed WordPress MySQL Database Name And User Name we need to re-configure those details on wp-config.php file and re-authenticate user permission. Otherwise it will gives error establishing connection to the database with or without “We were able to connect to the database server (which means your username and password is okay) but not able to select the (username)_WordPress database” with “Does the user (username) have permission to use the (username)_WordPress database?“.

In order to follow my this tutorial your cPanel should available PHPMyAdmin script. Apart from that, it’s better make a backup. Because database contains all the useful information, posts, comments, user information. In case if anything goes wrong, it will affect your site and sometime your site can go offline.

This tutorial will not change the MySQL table prefix. If you need to change them, you can follow rename WordPress database table prefix tutorial.

 

Warning!

Rename WordPress database and user is a highly dangerous procedure. If anything goes wrong, your  site can completely destroy. Specially your blog posts, comments, user information. Therefore first make a database backup.

Wordpress logo image

Rename WordPress database name and database user name.

 

See also  How To Backup WordPress Files To Dropbox, Amazon S3, Google Drive Free

Rename the database name.

  • Log-in to your cPanel account.
  • Then navigate to the “Databases” category.

cPanel phpMyAdmin

  • Next click on the “phpMyAdmin” link. Now it will open in a new tab.
  • Click the top navigation menu “Operation” tab, just like the following screenshot.

phpMyAdmin operations tab

  • Under the “Rename Database to”, type your cPanel user name, then add an underscore symbol (_ ) after that add unique letters with few numbers for your new database name. For an instance “<cPanel user name here>_did45″ for an example “aka25a_saf45a“. If you are not added your cPanel user name at the front of the new name, your database will disappear on your account.

start the rename

  • To apply change click “Go”.
  • Within a few seconds, you can see a confirmation message.
  • Now database renames completed. Next we have to grant the permission to access database user.

 

Rename database user.

  • Go to “MySQL Database”.

cPanel MySQL

  • Then under the “Add New User”, type new user name. Then use its “password generator” create a strong password. Copy that password in a text file.

create new user page

  • To complete the process click “Create user” button.
  • Then you have to grant the permission using the following steps.

 

 

Grant the permission to read renamed Database to new and existing user.

  • Go to cPanel “MySQL Database”.

cPanel MySQL

  • Under the “Add User To Database” select your new database and user.

Add user to database

  • Click “Add” button.
  • Then click on the new user name.
  • Next page, choose all the available options and click “Make Changes”.

Grant the permission to new user

  • Now almost completed.
  • Next we need to copy this information in your WordPress WP-config. PHP file.
See also  How To Cloak WordPress Links And Track Status - Mask Affiliate

 

 

Edit wp-config.php file.

After renaming step completed, we have to submit new information to WordPress. Otherwise it will give error.

  • In cPanel go to “Files>File manager.
  • Next flash menu click “Go”.
  • Then browse the “wp-config.php” file.
  • Right click on that file and choose “edit”.

start editing wp-config

  • In a new tab, wp-config file will open. Search following lines and add your new details.

define(‘DB_NAME’, new name here‘);

define(‘DB_USER’, ‘new user name here‘);

define(‘DB_PASSWORD’, ‘new password here‘);

sample wp-edit screenshot

  • Save the file.
  • Congratulation, you have just renamed WordPress database name and user name.
error: Content is protected !!