Use mysqli_connect and its associated mysqli_... functions instead of mysql_connect.
Two reasons.
1. mysql_connect is being deprecated.
(See http://us3.php.net/manual/en/function.mysql-connect.php )
2. I've found that accessing MySQL with my own code concurrently with WordPress using MySQL can fail when I use mysql_connect.
Will