If you require a database for an application, this is the guide for you.
In your control panel, first navigate to the 'MySQL Database Management' page:

On this page you will be presented with a series of form fields.
The first field to fill in is the one adjacent to the button labelled 'Create Database Name'.
Enter in this field a name for your database, as shown in figure 1.1:
figure 1.1

Click the button labelled 'Create Database Name'.
Providing all has gone smoothly you should be presented with the following notification:

Now before you can access this database you need to add a user to it, this is done with the form below the database creation one.
Fill in a username and a password as shown in figure 1.2:
figure 1.2

Click the button labelled 'Create Username', if all is okay you will again be presented
with the following notification:

If something is incorrect you won't be presented with this screen, so make sure you see this notification.
Now below this form is another form, situated on which are two drop down menus, they should now be populated with the user you just created in the first drop down and the database you just created in the second.
Make sure the user you created and the database to which you wish to assign privileges to are selected, once done check the checkboxes as shown in figure 1.3:
figure 1.3

If you're not sure what privileges your application requires, then check all the boxes. If you do, feel free to fine tune it.
Again, providing all has gone smoothly you will be presented with the following notification:

Removing databases, users and revoking user privileges
If at any point you wish to revoke the user's permissions and assign a new set, simple check the check box in the 'revoke' column as show in figure 2.1:
figure 2.1

Then click the button labelled 'Revoke'. Once done you can reassign the privileges.
n.b: This does not delete the user, it merely removes access for that specified user to the database.
If you wish to delete a user, select the username from the drop down and click the button labelled 'Delete' as shown in figure 2.2:
figure 2.2

To delete a database follow much the same instructions but select it from the 'Database Name' dropdown as shown in figure 2.3:
figure 2.3

That is the database creation completed, now a few simple examples of how to connect:
MySQL driver
CODE
<?php
define('DB_HOST', 'localhost');
define('DB_USER', 'testsite_zymichost_com_myuser');
define('DB_PASS', 'password');
define('DB_NAME', 'testsite_zymichost_com_mydb');
define('DEBUG', true);
$con = mysql_connect(DB_HOST, DB_USER, DB_PASS);
if(!$con)
{
// error connecting
if(DEBUG === true)
{
die('Database connection error: ' . mysql_error());
}
else
{
die('Failed to connect to the database.');
}
}
if(!mysql_select_db(DB_NAME, $con))
{
if(DEBUG === true)
{
die('Failed to select database, error: ' . mysql_error());
}
else
{
die('Failed to connect to database.');
}
}
?>
define('DB_HOST', 'localhost');
define('DB_USER', 'testsite_zymichost_com_myuser');
define('DB_PASS', 'password');
define('DB_NAME', 'testsite_zymichost_com_mydb');
define('DEBUG', true);
$con = mysql_connect(DB_HOST, DB_USER, DB_PASS);
if(!$con)
{
// error connecting
if(DEBUG === true)
{
die('Database connection error: ' . mysql_error());
}
else
{
die('Failed to connect to the database.');
}
}
if(!mysql_select_db(DB_NAME, $con))
{
if(DEBUG === true)
{
die('Failed to select database, error: ' . mysql_error());
}
else
{
die('Failed to connect to database.');
}
}
?>
MySQLi driver:
CODE
define('DB_HOST', 'localhost');
define('DB_USER', 'testsite_zymichost_com_myuser');
define('DB_PASS', 'password');
define('DB_NAME', 'testsite_zymichost_com_mydb');
define('DEBUG', true);
$db = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_PASS);
if(!$db)
{
if(DEBUG === true)
{
die('Database connection error: ' . mysqli_connect_error());
}
else
{
die('Failed to connect to database.');
}
}
?>
define('DB_USER', 'testsite_zymichost_com_myuser');
define('DB_PASS', 'password');
define('DB_NAME', 'testsite_zymichost_com_mydb');
define('DEBUG', true);
$db = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_PASS);
if(!$db)
{
if(DEBUG === true)
{
die('Database connection error: ' . mysqli_connect_error());
}
else
{
die('Failed to connect to database.');
}
}
?>
PDO Driver:
CODE
<?php
define('DB_HOST', 'localhost');
define('DB_USER', 'testsite_zymichost_com_myuser');
define('DB_PASS', 'password');
define('DB_NAME', 'testsite_zymichost_com_mydb');
define('DEBUG', true);
try
{
$db = new PDO('mysql:host=' . DB_HOST . ';dbname=' . DB_NAME, DB_USER, DB_PASS);
}
catch(PDOException $e)
{
if(DEBUG === true)
{
die('Database connection error: ' . $e->getMessage());
}
else
{
die('Failed to connect to database.');
}
}
?>
define('DB_HOST', 'localhost');
define('DB_USER', 'testsite_zymichost_com_myuser');
define('DB_PASS', 'password');
define('DB_NAME', 'testsite_zymichost_com_mydb');
define('DEBUG', true);
try
{
$db = new PDO('mysql:host=' . DB_HOST . ';dbname=' . DB_NAME, DB_USER, DB_PASS);
}
catch(PDOException $e)
{
if(DEBUG === true)
{
die('Database connection error: ' . $e->getMessage());
}
else
{
die('Failed to connect to database.');
}
}
?>
A couple of caveats; when creating a database, the name, the user and password only allows alpha-numerical input, other characters will cause it to fail.
That about wraps it up.
