Platinax: For Entrepreneurs Platinax Business Forum Platinax Business Directory Platinax Business News Business Blog
 
January 9, 2006

How to create a MySQL database in CPanel

Link: How to create a MySQL database in CPanel

by Brian Turner

Lots of online software needs to run from a database, and a PHP with MySQL combination is a common requirement.

However, setting up a database online can seem like a daunting prospect if you’ve never done one before.

Luckily, website control panels make this a relatively easy and painless process.

Cpanel is probably the most common control panel offered by webhosts, so this tutorial will show how to set up a MySQL database in CPanel.


Step 1: Log into your website control panel - CPanel - using https://www.domain.com:2083, where “domain.com” is the domain you are setting up your database for.


Step 2: The different themes available differ according to webhosts, but look for the option “MySQL Databases”, and click through.

NOTE: In the iconic CPanel X theme, this is on the third line down; if you’re on a text-based menu such as Bluelagoon, you’ll find it under the “Databases” heading at the bottom right.


Step 3: Look for the input box that says “db” in front of it. This is where you will name your database.

*IMPORTANT NOTE*: the name you enter here is not the actual database name, but will be appended to your account username to create the database name.

For example, if your account username for CPanel is username and you enter database as the database name, the actual database name will be username_database.


Step 4: Click on the button “Add Db” next to the input box.


Step 5: Return to the MySQL page as suggested.


Step 6: Now we need to create a username and password for a user to access your database.

Find where it has input boxes for “Username” and “Password” and enter your preferred values, noting the following important points:

- The username value may not be longer than 8 characters

- The username will be appended to your account username as with the database name. So, if your account username for CPanel is username and you enter username as the database username, the *actual* username will be username_username.

This does not apply to the password input.


Step 7: Click on the “Add User” button - and voila! - you have created a user to access the database.

However, we’re not quite finished yet - we need to add the user to database.


Step 8: Click back to the MySQL databases page, and note that your database name, and username, now appear in a pair of boxes together. If this is the user and database you wish to create an association for, click on the button underneath for “Add Uer to Db”.

That’s the hardest part done! You’ve created a database in CPanel and added a user through which your software can access that database!


Step 9: One last step - your PHP software will have a config file somewhere - these provide instructions for your software to access the database.

Open it up in a text editor, and edit the following values, or nearest equivalent, with those you have just set up:

    database name:”";
    database user:”";
    password:”";

For example:

    database name:”username_database”;
    database user:”username_username”;
    password:”password”;


Conclusion: Still a little uncertain?

Okay, here’s a more specific example:

The username at Platinax is “platinax”. Therefore if I set up a database here, the database name and username will be prefixed with platinax_

So if I set up a new database, and call it dbse, the database name is database_dbse

If I enter a username bob, the username for the database will be platinax_bob

I would therefore enter into the software config file:

database name:”username_dbse”;
database user:”username_bob”;
password:”password”;


Email This Post Email This Post Print This Post Print This Post



>> Discuss this story in the Platinax Business Forum

Add to Bookmarks:

ADD TO DEL.ICIO.US ADD TO DIGG ADD TO FURL ADD TO NEWSVINE ADD TO NETSCAPE

ADD TO REDDIT ADD TO STUMBLEUPON ADD TO TECHNORATI FAVORITES ADD TO SQUIDOO

ADD TO WINDOWS LIVE ADD TO YAHOO MYWEB ADD TO GOOGLE ADD TO SPURL

Related posts to "How to create a MySQL database in CPanel":


No Comments »

No comments yet.

Leave a comment


Previous: « The Search by John Battelle
Next: The Value of Customers »

Visited 60 times, 4 so far today