mysql_connect doesn't work like you think it does. It doesn't 'set' a database for you... it merely connects you to query processor. YOU control access to databases and tables via user ids & passwords, and grants. NORMALLY, You should be using different user ids & passwords... to access different databases. I keep all my connection information in external files that are named according to the db and host that the db is running on... eg: hostname-dbname.php host1-devdb.php host2-tstdb.php host3-prddb.php a main include file, then uses the $_SERVER['SERVER_NAME'] to determine the appropriate file, based on which host the script(s) are running on. This insures that you don't have developers doing stuff to the production database... and you don't have cross db security issues. I hope all that makes sense.