WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Using cPanel

This tutorial provides step-by-step examples of creating a database and database user using the cPanel MySQL Database Wizard tool.

Login to your site

Login to your hosting control panel (cPanel) with information provided by your host company.

MySQL Database Wizard

Under the Database section, click on the MySQL Database Wizard icon.

MySQL Database Wizard icon

Step 1. Create a Database

Step 1 in the wizard is creating the database. Simply give your database a name. The actual database name will be prepended by your hosting account name. In this example, after clicking Next Step, the database michaelh_demowp will be created.

Step 1. Create a Database

Step 2. Create Database Users

The next step in the wizard requires creating a database user and assigning that user a password. When entering the password, make sure the password strength meter registers Very Strong for your selected password. Also remember the password you enter as you will need that information later. In this example, dbuser is entered in the Username field, but when the Create User button is clicked, the database user ultimately will be named michaelh_dbuser.

Step 2. Create Database Users

Step 3. Add User to Database

In Step 3, you assign the user to the database and you assign the necessary database privileges. In this case, click the All Privileges checkbox and click the Next Step button to assign all privileges to the database user.

Step 3. Add User to Database

Step 4. Complete the task

In this step, you are notified that the user was addeed to the database. You have successfully created the database, created the user, and assigned privileges to that user.

Step 4. Complete the task

Editing the WordPress Config File

Open the file wp-config-sample.php using a text editor. There are the four pieces of information you need to complete in the file. The following is an example; yours may look slightly different:

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'michaelh_demowp');

/** MySQL database username */
define('DB_USER', 'michaelh_dbuser');

/** MySQL database password */
define('DB_PASSWORD', 'abc.123.!@#');

/** MySQL hostname */
define('DB_HOST', 'localhost');

Note that the prefix michaelh_ assigned by that cPanel is part of the database and database user. Also note, the DB_HOST value for almost all cPanel hosts is localhost.

Important!!!! Save the completed file as wp-config.php.

Continuing the Installation

The database is created, and user is created and assigned to the database with the proper privileges. And the wp-config.php is updated with the database information. At this point it is okay to move to Step 4 of the Installation process.