How to Change or Update Database Name of WordPress Website

Every wordpress website has two major components, Database where all information pertaining to that wordpress website is stored like user information, plugin settings, site settings, post, page information, including login credentials of that wordpress website. Second component is the file server where all files like images, themes, plugins etc is hosted and whenever a visitor requests to visit a page both database and file servers work synchronously to serve information to the user. Without either component wordpress website will not work.

As WordPress Database contains information about wordpress admin credentials and a lot of other sensitive information, malicious bots/users keep trying to get access to database of the website either to directly extract information about admin username and password or compromise the website by sql injection attacks on the website.

A lot of users use auto installers to install wordpress on their server which may not always pick a very difficult to guess wordpress database prefix resulting in bots compromising your website by bruteforce. Or if for some reason you think your database has been compromised and you want to make your WordPress Website more secure.

Follow the method given below to change your wordpress database name.

How to Change WordPress Database Name from Cpanel (phpmyadmin)

Step 1. Login to your server Cpanel, you can do so by typing in your browser

Step 2. Now in Cpanel look for option phpmyadmin

phpmyadmin cpanel
phpmyadmin cpanel

Step 3. Now login to the phpmyadmin area (just click on it to log in)

Step 4. Now from left sidebar Select the database which you want to change. If you want to know which the correct database you can find it in the wordpress files wp-config.php

Step 5. Now go to the “Operations” tab of the database as visible in below screenshot.

database namechange option
database namechange option

Step 6. Here you can see the option to rename the database as highlighted.

Step 7. Enter your new database name and click on the “Go” option.

Step 8. Now your database will be renamed.

Change Database user and Privileges

Now if you want to you can also change WordPress Mysql Database ‘user’

phpmyadmin cpanle
phpmyadmin cpanel

Step 1. Click on the Mysql Database.

Step 2. Scroll down to the bottom of the page. Create new user and password.

Step 3. Connect Database and User.

Step 4. Grant all privileges to this user.

Manage User Privileges
Manage User Privileges

Update New Database Name in WordPress

Step 1. Go to your wordpress website File manager.

Step 2. Edit wp-config.php file to update your new database name.