WordPress is a blogging platform built with PHP and it requires a MySQL database to function. If you will install WordPress on shared hosting service such as HostGator, you can create the MySQL database for WordPress from the CPanel. In this easy to follow WordPress tutorial we explain how to create a WordPress database using the CPanel wizard in just 5 steps.
If you host WordPress on your own server, you can create a MySQL database for WordPress using phpMyAdmin or the MySQL command line.
Creating a MySQL WordPress database from CPanel
- Login to your hosting provider CPanel, scroll down to the Databases section shown in the below screenshot and click on MySQL database wizard.
- In Step 1 of the wizard you have to specify a database name. Notice that most hosting provider add the username as database prefix, as shown in the below screenshot. The name of the database in this example is WPPro_WPDB8732. Click Next Step button to proceed with the MySQL database wizard.
WP White Security Security Tip: Avoid using predictable database names, such as blogdatabase or blogdb. In case a malicious user tries to guess the WordPress database name, by using non predicatable names you make it more difficult to guess.
- In Step 2 of the wizard you have to create a user which will be used to access the database. As per the example in the below screenshot, the username we created is WPPro_C0lloqu1. Once you specify a very strong password for the new user, click on “Create User” to proceed with the wizard.
- In Step 3 of the wizard, you will add the user to the database and specify its privileges as seen from the below screenshot.
WP White Security Security Tip: Typically the MySQL user only needs SELECT, INSERT and UPDATE data privileges for WordPress to function. Any other privileges, such as ALTER, CREATE and DROP are sometimes needed during an upgrade or when installing plugins and database structure changes are needed. In such cases, you will be advised by the plugin developer. It is important that whenever you assign structure related privileges, it should ONLY be temporary. You can read more about WordPress database privileges from the article Why minimum MySQL user WordPress database privileges help.
- In Step 4 of the MySQL database wizard you are advised that the newly created user has been added to the database you’ve created, as seen in the below screenshot. If you want to proceed with a WordPress install, then use the database name, username and password you have specified in this MySQL database CPanel wizard.