Page 1 of 1

mysql connection does not error

Posted: Tue Feb 11, 2003 8:22 pm
by redcircle
I've got a problem.


my code is not giving an error when it's supposed to.

Code: Select all

$db = MYSQL_CONNECT($db_host,$db_user,$db_pass) or die("Could not connect: " . mysql_error());

echo 'Connection Complete';
it correctly errors out if the $db_user actually exists or if $db_pass has a value($db_user remaining null), if the user does not exist and a password is not set script does not die.

enlighten me.

Posted: Wed Feb 12, 2003 2:09 am
by twigletmac
Have you checked who has what permissions on MySQL?

phpMyAdmin can be quite handy for keeping track of it all.

Mac

Posted: Wed Feb 12, 2003 8:27 am
by Rob the R
Permissions may be the key, as twigletmac mentioned. When no username or password is passed, do you actually get a working connection to the database? If so, MYSQL_CONNECT is probably able to connect to the database with the default values for username and password:
The following defaults are assumed for missing optional parameters: server = 'localhost:3306', username = name of the user that owns the server process and password = empty password.
Check for permissions and verify that you have a non-null password set for the server process owner.