WordPress stores content such as posts, blogs, comments, pages, usernames, etc and requires a database (DB) to store and maintain all this information. A database is a storehouse that enables you to organize and maintain your information. WordPress runs at its best on a MySQL database. All web hosts have a built-in MySQL server and database support. The following sections will help you understand how to set up a MySQL database on a web host using cPanel.
Creating a Database
The first step in setting up MySQL is creating a database.
To create a database:
- Click MySQL Databases.
2. Enter a new database name (e.g. blogva5_test1). The database name comes with a prefix which is your cPanel username.
Creating a Database User
Once you have created the database, you will need to create a user. A database user is required to add, retrieve, or alter any content within the database.
To create a user:
Enter username (only alphanumeric characters are allowed).
Enter a strong password. A strength indicator is provided that will help you discern the strength of your password. You could also use the Password Generator that will provide you with potential passwords with a single click. Remember to save this password for later use.
Adding a User to a Database
Once you have created a database user, you have to associate it with the corresponding database.
To add user to a database:
Select the user from the drop-down list.
Select the database from the drop-down list.
Check All Privileges so that the database user can access and modify the entire WordPress content.
Click Make Changes.
WordPress Config file
The database name and its corresponding user have to be included in the WordPress configuration file – wp-config.php – in order to successfully access the database. A sample configuration is as shown below:
// ** MySQL settings – You can get this info from your web host ** //
/** The name of the database for WordPress */
/** MySQL database username */
/** MySQL database password */