Creating a MySQL Database

There are lots of ways to create a MySQL database, because of the huge varieties of hosting control panels available. Unfortunately, executing CREATE DATABASE `database`; rarely works because of the way permissions are set up. This tutorial covers creating a database in cPanel, as well as on popular hosts Site5 and GoDaddy.

Creating a Database in cPanel

First things first, log in to your cPanel. This is usually available through http://www.your-website.com/cpanel (where your website is the address of your website). CPanel is not available on any free hosts that I am aware of; this tutorial is intended for paid hosting/domain name owners.

Once logged in, click the text “MySQL® Databases” that is linked underneath the MySQL logo. On the page you will see any databases that you/others have created previously, then the words “New Database:” followed by an input box. Type the name of your required database into the field and click the “Create Database” button once. If this action was successful, you will see a “Database Created” message. On ‘shared’ hosting, the database will usually be created with a prefix of your username (the name you log in to cPanel with).

To use the database you must create or assign a user to it. If you don’t already have a user, type in a username and password into the provided boxes and click “Create User” (users are also given a prefix). Once created, use the drop down menus under “Add Users To Your Databases:” to assign the user to the database. (Do not touch the Privileges checkboxes; these control what each user can do with a database and are not important right now.) Tada — your database is ready to use.

Creating a Database in Site5 SiteAdmin

As with the previous example, the first step is to log in to SiteAdmin. This can be found by going to any one of three URLs: http://www.your-website.com/cpanel, http://www.your-website.com/netadmin or http://www.your-website.com/siteadmin (where your website is the address of your website). When you’ve logged in, click the “mySQL Databases” option in the left-hand column, then select “Manage Databases” from the options that drop-down underneath.

On the “Manage MySQL Databases” page, scroll to the bottom until you reach the box titled “Create MySQL database”. Enter in the name of the database you wish to create (as above, the database name will be prefixed with your username; Site5 point this out though). Once you’ve typed in the name you want, click “Create MySQL Database” and your database will be created.

To assign a user to your new database, click “Manage Users” in the left navigation list. First create a new user with a username and password of your choice, then use the drop-down menus under “Grant permissions on a MySQL database to a MySQL user” to select your new user and new database. Click “Grant Permissions” to complete the procedure.

Creating a Database in GoDaddy

First, find your GoDaddy control panel. I find this easier said than done (and I’m probably missing a neato shortcut) but for me this involves going to godaddy.com and logging in with my account number and password using the form on the right-hand side. Once logged in, click the link “My Account” that appears where the form was, and in the “Hosting & Servers” drop-down, choose “My Hosting Account”. Click “Open” under “Control Panel” for the domain you wish to create a database on.

When your Hosting Manager window opens, and assuming Godaddy have put you on the right account package, click “MySQL” under the “Databases” title. Click the “CREATE NEW DATABASE” button; this is where Godaddy differs to typical hosts. It will ask you to enter a description, username and password. You can leave the description blank but the username also becomes the name of the database.

You must prefix the username yourself (otherwise you will get ‘username taken’ errors). I.e. if your domain name is “www.ilovesocks.com”, I suggest creating a username of ilovesocks_database (where database is what you want it to be called). You can only have numbers and letters in your password. However, the advantage to Godaddy’s method is that you do not have to fiddle with assigning users and permissions (although the database creation process can sometimes take a few minutes) and this completes the process.

Speak Your Mind

*