Do you want to know how to create a MySQL database and user in cPanel? This article will help you to quickly create a database and link to a database user.
When you are creating a database, you need to do it as well. The new database creation process actually involves:
- Creation a Database
- Creating a Database user
- Link database with user
In this article, I will show you how to create a MySQL database and user in cPanel.
To Create MySQL Database and User
Creating a database is one of the most common tasks before building a new site with WordPress. Your cPanel and phpMyAdmin make this process easier than before.
Here I am going to show you how to create a MySQL database and user. You can also learn how to link a database to a user.
If you are cleaning a hacked website, then it is very important to change your MySQL username and password before creating a new database or importing it into the existing database.
Create MySQL Database
To create a new database, log in to your cPanel dashboard of your WordPress hosting account. Go to the Databases section and click on the MySQL Database icon.
Now you will be asked to provide a name for your database and then click on the Create Database button.
After creating a new database, you need a MySQL user associated with the new database.
Create New Database User in cPanel
It is common practice to create a unique user for each database.
Scroll down to the MySQL user section and add a new user.
Next, you need to add this user to the MySQL database. Scroll down to Add user to the database section and select the user from the drop-down menus.
After selecting the user then click on the add button.
On the next page, you will assign privileges for the user to the database. Check the box next to All Privileges and then click Next.
Congratulations, your new database is ready. Now you have learned how to successfully create a database.
You can use this database and user to restore your WordPress database.
Restore your database
To restore your database go to the phpMyAdmin option under the Database section, then click on the phpMyAdmin icon.
Now you need to click on your new database name, which is you created earlier, and then click on the import button.
Click on the ‘Choose file’ button to select your WordPress database backup file on your computer.
After selecting the backup file, then click on the ‘Go‘ button at the bottom of the page.
PhpMyAdmin will upload your backup file and import it into your database.
After finishing this process, you will see a success message on your screen.
That’s all you have successfully imported to your WordPress database.
Now you need to install a WordPress file using your new database. After installing WordPress, then you need to add your new database. To do this go to the wp-config.php file, which is on your root folder like public_html.
Open your wp-config.php file with your code editor and enter your new database information like database name, database username, and database password.
After providing all of your database information, don’t forget to save the change.
Once all is done, visit your WordPress website to check that everything is working.
That’s all, I hope this article helped you learn how to create MySQL database and user in cPanel. You may want to see the guide on how to backup WordPress database manually.
You may also want to see another guide on How to fix Error Establishing a Database Connection in WordPress, How to Fix “Briefly Unavailable for Scheduled Maintenance” Error in WordPress, and How to Fix 500 Internal Server Error in Your WordPress
If you like this article, then please share it with your friends.