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:

  1. 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:

  1. Enter username (only alphanumeric characters are allowed).

  2. 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:

  1. Select the user from the drop-down list.

  2. Select the database from the drop-down list.

  3. Click Add.

  1. Check All Privileges so that the database user can access and modify the entire WordPress content.

  2. 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 */

define(‘DB_NAME’, ‘blogva5_test1’);

/** MySQL database username */

define(‘DB_USER’, ‘blogva5_123’);

/** MySQL database password */

define(‘DB_PASSWORD’, ‘*******’);

Would love your thoughts, please comment.x