How to Create MySQL Databases

There are a few steps to successfully creating a database in your cPanel hosting account. You can create it from inside cPanel by logging in and navigating to the Databases section.

  • Step 1: Navigate To The MySQL Databases Application In cPanel
  • Step 2: Enter Information For Your Database
  • Step 3: Return To The Database Manager Page And Create A New User
  • Step 4: Create A New Database
  • Step 5: Log In To The New Database 

 

Step 1: Navigate To The MySQL Databases Application In cPanel

Select "MySQL Databases"

 

Step 2: Enter Information For Your Database

Enter a name for the database in the New Database field. Click on the "Create Database" button to complete that step. You can also select and go through the prompts of the "MySQL Database Wizard."

A confirmation screen will then be display, informing you that the database has been successfully allocated.

that the MySQL database you created will use your cPanel username as a prefix -- so the overall name will be username_dbname and you will always need to refer to it that way.

 

Step 3: Return To The Database Manager Page And Create A New User

To continue your database setup process, click on the "Go Back" option from that confirmation screen above to return to your database management page. Scroll down to the latter section and you'll see "Add New User" under the MySQL Users title.

Enter a username that is 7 characters MAX. Enter a password twice. Click on the "Submit" button when you've done that to save the MySQL user.

that the MySQL user is also created with your cPanel username as a prefix -- cpuser_dbuser. This full username needs to be used whenever you want to connect with this user name.

Now that the database has been created as well as a user, you will need to assign that user to the database in order to provide it with the correct permissions.

 

Step 4: Create A New Database

Click on the "Go Back" button to return to the database management screen. Select the new user that you created from the "User" dropdown menu. Then select the new database you created from the "Database" dropdown menu. Click on the "Submit" button.

You will be redirected to a screen where you will be prompted to choose the desired privileges for the user in the database. It is advisable to select "All Privileges" so check that box at the top and then select the "Make Changes" button.

Now you have successfully created a MySQL database and a User to access it. All the parts should now be in place for you to utilize a script that can login and utilize that database successfully.

 

Step 5: Log In To The New Database 

Default Script Settings to authenticate and connect to MySQL are usually as follows:

The address or path to your database or to MySQL is localhost
The full database name is cpusername_dbname
The username to access the database is cpusername_dbuser
The password to access the database will be whatever password you configured when you set up the user in cPanel.

That's it! You have successfully created a database, added a user with privileges to access it, and entered all the details you need to set up your script so that it can use the database!

Contact Tech Support if you run into trouble with any of these steps.

 

Was this answer helpful? 417 Users Found This Useful (1851 Votes)