To create the database, do the following:
- Log into the cpanel
- Click the MySQL Databases icon under the "Databases" category
- Create a New Database (make it short best result)
- Add New User (make it short best result)
- Most importantly, select the user and database underneath "Add User To Database" and click "Add" (authentication will not work if you do not click this button).
After doing all these steps, you can create the database tables either via phpMyAdmin or use an online PHP or Perl script.
The username format will be: username_dbusername
The database format will be: username_dbname
The hostaddress will be: localhost
For example, if you enter 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
dataName: username_db01
dataUser: username_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 above example variables:
-
Connection Strings
For PERL
$dbh = DBI->connect("DBI:mysql:username_db01:localhost","username_admin","password");
For PHP:
-
$dbh=mysql_connect ("localhost", "username_admin", "password") or die ('I cannot connect to the database.');
mysql_select_db ("username_db01");
To create tables and other functions, you can use the PHPMyAdmin located in the Databases section of the cPanel. For more information on how to work with PHPMyAdmin. please visit: phpmyadmin.net
.