How to Rename or Change WordPress Database Name

Generally, when you are installing WordPress manually, you also need to create a new database to work with the WordPress. While creating the database, you can name it whatever you want, probably.

But if you are using automated installation scripts like Fantastico,¬†Softaculous, etc.., then the scripts may sometimes randomly name your WordPress database. The automatic naming of the database may not be descriptive but is pretty good as you don’t have to mess with it.

As useful as it is, if you have multiple databases, then you need to have a good descriptive database name in order to differentiate between them.

So, if you ever need, here is how you can easily rename or change WordPress database name in simple steps.

Rename or Change WordPress Database Name

Since we are going to make the modifications to the actual database, make sure that you have a good and complete backup of your WordPress database. Just in case.

1. Renaming or changing the WordPress database name is pretty easy and fast. To start off, open your cPanel, find and click on the link “phpMyAdmin” under the Databases section.

Quick tip: You can use the search feature in the cPanel to quickly find the option or module you need.


2. Once the phpMyAdmin panel has been opened, select the tab “Databases” and then again select the database you want to change the database name. For instance, I’m selecting the database “dev” as I want to change the name of it.


3. The above action will open the selected database and shows you all the tables. Here, click on the tab “Operations” appearing on the top navigation bar.


4. Once the operations panel has been open, enter your new database name in the blank field under the “Rename Database to” section and click on the button “Go” to complete the process.


In my case, I’ve entered my new database name as “dev_blogger.”

Configure wp-config.php File

After changing the database name in phpMyAdmin, you need to reflect the changes in your wp-config.php file.

5. So, open the file using any of your favorite FTP clients and replace the old database name with the new one. Once replaced, it will look something like this.


Once you are done with the changes, save and reupload the file.

Assign User to Database

6. The last thing you need to do after changing the database name is to add a user to the modified database. To do that select “MySQL Databases” under the Database section in your cPanel.


7. Now, under the “Add a User to a Database” section, select your username from the drop-down menu and then select the database you want to assign from the drop-down menu and click on the “Add” button.

8. The above action will add the user and reloads the page. Here select the checkbox “All Privileges” and click on the “Make Changes” button to save the changes.


That’s all there is to do and it is that simple to rename or change WordPress database name. Also, don’t forget that the default WordPress table prefix is sometimes prone to hack attacks. So, learn how to change WordPress table prefix as a WordPress security measure.

Hopefully that helps and do comment below sharing your thoughts and experiences about changing the WordPress database name.