How to create a MySQL database in cPanel

One of the first steps you need to take before installing any database driven web package is to create a database, and most use the open source MySQL server.

For this tutorial I am going to be using cPanel because that’s what I’ve used most often. Other hosting control panels are similar.

MySQL Control Panel

Log into your cPanel control panel and click on the MySQL icon. It looks like the following.

mysql_icon.gif

Creating a new database

You will be taken to the MySQL Account Maintenance page. Look for the ‘New Database’ section. It looks like this.

new_database.gif

Give your database a name. For this tutorial we’re going to call our database ‘buddy’ (I originally wrote this tutorial for ProofBuddy). So type ‘buddy’ into the box next to ‘New Database:’ and click ‘Create Database’. You should be taken to a screen that looks like the following.

db_created.gif

If you come to this it means that you’ve successfully created your databse. If you come across an error please ask your host about the problem.

Click on ‘Go Back’ to be taken back to the MySQL Account Maintenance page.

Adding a user

Your next step is to add a user that can access your database. Just below the New Database box we used before is a pair of boxes with ‘Username’ and ‘Password’ next to them. Enter ‘buddy’ for the username and whatever password you want - I’m going to use ‘password’, a really, really bad idea for a password but good as an example. Then click on ‘Create User’. You should be taken to the following screen.

added_user.gif

Now you have a username and password you can use for your database. But you also need to give your new user permission to access the database you just created. Click on ‘Go Back’.

Giving Permissions

Just below the boxes where you added your user you will see a section titled ‘Add Users To Your Databases:’.

One thing to notice, the database and user you created both have a prefix. This prefix should be the same as your cPanel login name. For this example it’s ‘buddy’, but it could be what you chose when you created your account or it could be a string that your host assigned to you when your account was set up. This is important because when you enter your database name and username during the installation for your web software you will need to include the prefix as well.

addusertodb.gif

Select your new user in the first drop down and the new database in the second. Leave the checkbox next to ‘ALL’ checked and the rest unchecked. Then click ‘Add User To Database’. You should be taken to the following screen.

accountadded.gif

And we’re done

Congratulations. If you’ve gone through the steps above and haven’t come across any errors you have successfully created a MySQL database for your web program to use. Be sure to take note of the database name and username you just created (don’t forget the prefixes) because you’ll need them when you setup your program.

Question, Comments...

Do you have more questions. Please either leave a comment below or join us in our new forum.

3 Responses to “How to create a MySQL database in cPanel”

  1. [...] Creating the Database Etomite uses a MySQL database to hold all of the pages and settings. Rather than rehash a tutorial that’s already here, I’m going to direct you to a post from yesterday explaining how to create a MySQL database. [...]

  2. [...] MySQL database You will need a MySQL database to hold your blog posts. I wrote a tutorial on how to create a MySQL database in cPanel a few days ago. Other hosting control panels should be [...]

  3. [...] Creating your MySQL database SMF needs a MySQL database to store your settings and messages. If you’ve never created a MySQL database I have a tutorial on how to make a MySQL database in cPanel. [...]

Leave a Reply