Portal Home > Knowledgebase > cPanel Guides > How do I create an empty MySQL Database?


How do I create an empty MySQL Database?




To create the Database, you would go to your cpanel

1. Log into the cpanel
2. Click the icon for MySQL
3. Create a user (make it short best result)
4. Create a DB (make it short best result)
5. Most important, Click Add User to DB button (authentication will not work if you
do not click this button)

After doing all these steps, you can create DB either phpmyadmin or use an online php script or perl script. Some examples of free softwares that incorporate this into their setup utility is ikonboard forum, phpBB2 forum.

Your username format will be: webusername_dbusername
Your DB format will be: webusername_dbname
Your hostaddress will be: localhost

For example if you have the following variables:

dbusername: admin
dbname: DB1
password: password

You will end up with the following format that you would place
in your connection string

Hostname: localhost
DBName: johndoe_DB1
DBUser: johndoe_admin
Password: password

Notice the password remains the same format.

The connection string can be either of any examples below:

For example, we will use the following Variables:

Hostname: localhost
DBName: johndoe_DB1
DBUser: johndoe_admin
DBPassword: password


Connection Strings
For PERL
$dbh = DBI->connect("DBI:mysql:johndoe_DB1:localhost","johndoe_admin","password");

For PHP

$dbh=mysql_connect ("localhost", "johndoe_admin", "password") or die ('I cannot connect to the database.');
mysql_select_db ("johndoe_DB1");

To create tables and other functions, you can use the PHPMyAdmin located in the MySQL
Link of the cpanel. Simply log into your cpanel, click the MySQL logo, scroll down to
the very bottom of the page and click the name PHPMYADMIN.

For more information on how to work with PHPMyAdmin youc an go to:

http://www.phpmyadmin.net

Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
Deleting A MIME Type (Views: 1535)
Addon Domains (Views: 1563)
Deleting A Cron Job (Views: 1525)

Powered by WHMCompleteSolution