Once you have created a database, there are a few ways you can connect to it.
To connect from a PHP script, just put this in your file:
<?
mysql_connect("DBSERVER", "DBUSERNAME", "DBPASSWORD" ) ;
mysql_select_db("DBNAME" ) ;
?>
using the following substitutions for the bold terms as above, plus substituting DBPASSWORD with your own mysql password:
Replace DBSERVER with the correct database servername for your site.
Replace DBUSERNAME with your own mysql username.
Replace DBNAME with your own mysql databasename.
The connection will be closed automatically when the script ends as i remember from
php tutorials. To close the connection before, use the mysql_close() function:
<?php
$con = mysql_connect("localhost","peter","abc123" ) ;
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
// some code
mysql_close