
How to Create a MySQL Database and User in cPanel for WordPress
How to Create a MySQL Database and User in cPanel for WordPress
Follow this simple step-by-step guide to create a MySQL database and user in cPanel — a necessary step for installing WordPress manually or managing your site database.
Why Do You Need a MySQL Database for WordPress?
WordPress stores all your website’s content, settings, posts, and user data in a MySQL database. To run WordPress, you must have a database and a user with permissions to access it.
Step 1: Log into Your cPanel Account
Go to https://yourdomain.com/cpanel
or your hosting provider’s login page and enter your credentials to sign in.
Step 2: Open the MySQL® Databases Section
In the cPanel dashboard, scroll down to the Databases section and click on MySQL® Databases.
Step 3: Create a New Database
- In the Create New Database field, enter a name for your database. For example,
wp_database
. - Click Create Database.
- You will see a confirmation message that the database was created successfully.
Step 4: Create a New Database User
- Scroll down to the MySQL Users section.
- Under Add New User, enter a username (e.g.,
wp_user
). - Enter a strong password or use the Password Generator tool to create one.
- Confirm the password by typing it again.
- Click Create User.
Step 5: Assign the User to the Database
- Scroll down to the Add User to Database section.
- Select the user you just created from the dropdown list.
- Select the database you created earlier.
- Click Add.
- On the next screen, check All Privileges to give the user full access to the database.
- Click Make Changes.
You will see a success message indicating the user has been added to the database with the correct permissions.
Step 6: Use Your Database Details in WordPress
When installing WordPress manually, you will need to enter the database name, username, and password during setup in the wp-config.php
file or the WordPress installation wizard.
Troubleshooting Tips
- Make sure the database name and username have the correct prefix assigned by your hosting provider (e.g., yourcpanelusername_wp_database).
- Use a strong, unique password to protect your database user.
- If you get permission errors during WordPress installation, double-check the user privileges in cPanel.