WordPress database includes all data saved in a web server. When it comes to choosing a name for your WordPress database, it is very important for you to create a unique name. The name should be easy for you to remember and at the same time, it should be different from others’. Besides, if you want to change your WordPress database name, you need to pay attention to the steps to avoid something wrong.
Actually, you should be clear about that all data in your database are very important for you, so it is very important to focus on its security and here we recommend you to choose a database name that is not easy to guess. In addition, we have compiled an article to tell you some tips on how to change your database name through phpMyAdmin which is also helpful to reset WordPress password and import and export MySQL database.
1. Change Database Name in phpMyAdmin.
We adopt cPanel in our Linux web hosting because it offers automation tools to make it easy to host a website and owns graphic interface. To meet most people’s needs, we have drawn up the article about changing the database name through phpMyAdmin in cPanel.
Log into your cPanel and then click phpMyAdmin. Now you can see a list of your databases. Then you need to choose the one that you want to make a change of. Once you have selected the right database, click it and you will see the screen appear like the pictures below. Then, click “operations”.
As is shown in the picture, you need to enter your new database name into the blank field. After ensuring that you have typed correctly, find out the icon “Go” on the bottom right corner of the page and then click it. In fact, you can create a name absolutely depend on yourself as long as it consists of numbers and letters.
After clicking “Go”, the screen will jump out the tip to make sure that whether you want to make the change or not. If you ensure, click “OK”. However, it is not enough to make the change effective because you need to make the new database name match with the wp-config.php file. Therefore, it is necessary for you to make some changes in wp-config.php.
2. Rename Database Name in wp-config.php.
Here you need to find out the wp-config.php file. We have summarized 2 ways to find it out. The first one is to use a FTP program because it is used to transfer files between different computers. In this way, once the connection has created, you can see the file and then you need to download it. Edit the wp-config.php file in a text editor.
In another way, you need make use of the inbuilt directory browser. Find out the wp-config.php file in the list in cPanel and click “Edit” button. Then the screen will jump out of the tip to ask you to click “Edit” again.
Now, in the text editor, you can see the file. Find the line “define (‘DB_NAME’, ‘your_db’)”. In this line, the ‘your_db’ is the name you want to change. Then you need to delete the name and enter your new name. Remember to save the file after changing. Moreover, if you open it by using FTP, you have to upload the file to the root directory. Now, you have completed all steps of renaming a database.
3. Assign a User to the Database & Configure the User Permissions.
Go back to the main interface and click “MySQL Databases” in databases section. Choose the option “Add a user to a Database” and select the username from the drop down box. You can find your user name in the same line as “DB_USER” in the wp-config.php file.
Now, move to the Database section and select “Add” button from the drop down box. Select “All Privileges”. Ensuring all the boxes are ticked and click the “Make Changes” tab. In addition, if you want other users to have different permissions, you can check the options for them respectively.