This file pretty much says it all...
But for starters make a access file that has your access credentials and set it outside your web root so it can't be accessed from outside (i.e. it will have no URL related to it so it can't be used)...
Then in every one of your scripts that call out to this database include or require this file...
The thing is like this:
Say you have a file named config.php where your access credentials are made like this:
$DB_HOST = "db_host";
$DB_NAME = "db_name";
$DB_USER = "db_username";
$DB_PASS = "db_pass";
Then on the page that you need connection to this database you make a call like this:
$dblink = mysql_connect($DB_HOST,$DB_USER,$DB_PASS);
mysql_select_db($DB_NAME,$dblink);
And you have a connection...
Now some more info on placing a file outside a web root:
Say you have a path to your web folder like: /usr/name/www/
You should place your config.php file previously mentioned somewhere like /usr/name/secure/
Next wherever you need to call for him you can call him by /usr/name/secure/config.php
And that's prety much it...
For the rest read on that file I gave you because you can learn a lot...
I'm no expert on this mater: I just read stuff...