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 .
2. Please select the name of your website database. Here we take an example database named db_domain123 .
3. Then, click the Operations menu and enter a new database name and press the Go button.
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.
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:
1. Please login to cPanel, then select the File Manager menu.
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 .
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 .
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 .
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 .
3. After knowing the database user name for your website, please open the MySQL Databases menu in the Databases column in cPanel.
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.
5. Please tick the ALL PRIVILEGES option and press the Make Changes button to save the changes.
6. Congratulations! In this step how to rename the WordPress database has been successful. Your website can be accessed properly as usual.
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.