How to Rename WordPress Database

Databases have a crucial role in websites because almost all important information about WordPress websites is stored there. That’s why you should know how to manage them, including how to rename databases in WordPress.

Fortunately, you can change the database name easily in phpMyAdmin. For example, you could rename the default database db_domain123 to  db_site123 .

By giving it the right name, you can shorten the management time. Because you will find it easier to find the database you want. In addition, a unique name will also make it difficult for hackers to access the details of your WordPress website database.

Here’s how to change the database name in WordPress

Step 1: Rename the Database in phpMyAdmin

To change the database name, you first need to login to your website’s control panel. In this example we are using cPanel.

1. After successfully logging into cPanel, please select the phpMyAdmin menu .

phpmyadmin menu in how to rename database

2. Please select the name of your website database. Here we take an example database named  db_domain123 . 

database name that has not been changed

3. Then, click the Operations menu and enter a new database name and press the Go button.

menu operations to rename database

4. A confirmation window will appear that the old database will be deleted and the table will be imported into the new database. Please click OK button to continue.

confirm the name of the database that has been changed

Langkah 2: Edit File wp-config.php

Next is to adjust the database name in the wp-config.php file with the new database name. The steps you need to take are as follows:

Also Read:  How To Add Your Website To Google News Feed

1. Please login to cPanel, then select the File Manager menu.

cpanel file manager

2. After that, please select the main directory of your website. This file is usually located in the  public_html directory . Right click on the  wp-config.php file  and select  Edit .

edit file wp-config

3. In the line define(‘DB_NAME’, ‘your_database’); please edit your_database section with the new  database name. We will change the database name in this tutorial to  db_site123 .

edit database name with new name

Step 3: Add User for Database

After you have changed the database name via phpMyAdmin and edited the database name in the wp-config.php file, next you need to add a user for your new database. To do so, please follow the steps below.

1. To be able to add users to the database, you need to know the username for your website beforehand. The method is quite easy, please edit the  wp-config.php file .

site db

2. In the  DB_USER line of code , you will see the username of your database. In this example section it is named  db_useranda .

rename database

3. After knowing the database user name for your website, please open the  MySQL Databases menu in the Databases column in cPanel.

open the mysql menu in the databases column

4. Select the database user in the Add User To Database section. The user is named db_useranda, then please select the database which in this example is named db_sites123. Press the Add button to continue.

add user to database

5. Please tick the ALL PRIVILEGES option and press the Make Changes button to save the changes.

select all privileges

6. Congratulations! In this step how to rename the WordPress database has been successful. Your website can be accessed properly as usual.

Also Read:  WP Rocket Pro plugin

How to Rename a Database is Easy, Isn’t it?

After changing the database name, your WordPress website will be more secure from hacker attacks. Because, they will be increasingly difficult to find out the name of your database.

Subscribe Now

Get a variety of tutorial articles, interesting insights and tips about the online world directly through your email. Subscribe now and be successful with us!
I am Omotunmihse Temitope (Xander), A Contents Writer, Web and Graphic designer, and A pro blogger who has a passion for blogging and has taken blogging as part of my daily activities.
en_USEnglish