How to create a MySQL database in cPanel
You’ll need to create both a MySQL database and a MySQL database User.
Log into cPanel
- Log into ClientZone.
- Click on the Hosting tab.
- Select the domain you want to use to create the MySQL database.
- Click on the cPanel button, and log in.
- Once on the cPanel page, scroll down to the option that says MySQL database and select it.
You will now see 2 sections, one is the current databases section and the other is the MySQL User section. As mentioned before, you will need to create a user, as well as the database, in order to access the MySQL database you create.
Create a Database
- Go to the top and you’ll see there is already a partial name, this is your cPanel name and your database will always be created with this prefix to make sure it’s identifiable to the server.
- Click ‘Create Database’ to continue. You’ll now see that your database has been added.
- Now click Go Back to create a user.
How to name your database. The best way to name your database is by using a name that relates to the content that will be stored in the database, so for instance if you create an ecommerce site you can use the name ‘shop’.
Create a Database User
Now you can see the database you just created under Current Database. You’ll notice there is no user added. We need to create one first.
- Go to Add a New User.
You’ll see that the cPanel prefix is also going to be used for your username. Enter the name you want to use for your username.
- Now you need a password.
Remember to make your password strong as databases carry a lot of sensitive information. If you’re worried you can use the Password Generator to create one for you. If you use your own password, you will be able to see the strength at the bottom of the section.
- Confirm your password and click Create a User.
You’re user is now created. Click Go Back to finish creating your database.
You’ll now see the user you just created under Current users. We now need to assign that user to your database.
How to assign a Database User to your MySQL Database
- Go to the Add a User to a Database section.
- Select the user you want and the database you want to assign that user to.
If you have more than one user or database, just select the dropdown menu and you will be able to choose the one you want to use.
- Click Add to proceed.
You now what to allocate the privileges you want the user to have when accessing the database. As this is the main user, you can simply click on All Privileges at the top of the screen.
Finally, select Make Changes. And your setup is complete.