Change WordPress Database Name

How can we change WordPress Database Name? This tutorial will show you how to change the database name in WordPress without installing any plugin. If you have set the most accessible name for the database, it’s easy for hackers to find your database name more comfortably.

Remember Alyaws, before any editing, make a backup from your data to ensure that nothing will happen.

Change WordPress Database Name

Go to your hosting panel, find the phpMyAdmin and then log in to the phpMyAdmin with your database username and password. If you don’t know your database username or password, you need to get to the public_directory and find the wp-config.php file and find.

These are your database username and password.

/** Database username */
define( 'DB_USER', 'your_username' );

/** Database password */
define( 'DB_PASSWORD', 'your_password' );

Select your database and then click on the Operations. And then, on the Rename database, put the name you want the database title to be.

Change WordPress Database Name
Change WordPress Database Name

Fill in your name here and click on the Go button.

Edit wp-config.php File

If you open your website, you will see a database connection error. So go to the public_directory of your hosting and then find the wp-config.php file and find this code and then edit it.

define( 'DB_USER', 'replace_your_new_database_name' );

You should replace your new database name here.

Assing a Database User

You should assign a user to the database. For doing this go to the MySQL Databases. Scroll to the Add a User to a Database section and select the database. Next, select All Privileges for this user.