Creating MySQL User and Database Tutorial

Learn how to create MySQL user and database

This tutorial explains how to create a new MySQL user and database.

How to create a MySQL user and database using the MySQL Database Wizard

By using the MySQL Database Wizard tool you can easily create a MySQL user and a database and then assign the user to the database. To access the tool, access your cPanel and click on the tool icon.

On the page that opens provide the desired MySQL database. Note that the database will always start with username_ prefix, where username is your cPanel user. Once ready, click the Next Step button.

On the next page you should provide the desired MySQL username and the password for it. Here the username is always prefixed with the cPanel username, similar to the database. When ready click the Create User button.

The user will be created for you and on the next page you are prompted to specify the desired permissions that the user has to the database. Choose the desired permissions and click the Next Step button.

That's it! Once the page loads you will see a confirmation message informing you of the successful completion of the operations.

How to create a new MySQL Database

To create a MySQL database you can use the MySQL Databases tool in cPanel.

In the Create a New Database section add the desired name of the database and click the Create Database button.

On the page that loads you will see a confirmation message about the successful creation of the database.

How to create a new MySQL User

To create a new MySQL user you can again use the MySQL Databases tool in cPanel. In the Add a New User section provide the desired username and a password for it. Then click the Create a User button.

On the page that loads you will see a confirmation message about the successful creation of the user.

How to add an existing MySQL user to a database

In order for a MySQL user to be used to manage a certain database, the user permissions for that database must be set. You can manage the MySQL user privileges from the MySQL Databases tool in cPanel.

From the Add a User to a Database section choose the desired user from the User: dropdown and the database from the Database: dropdown. Then click the Add button.

On the page that opens, choose the desired privileges the user should have to the database and click the Make Changes button.

A new section will appear confirming the successful change.