mysql connection does not error

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
redcircle
Forum Commoner
Posts: 43
Joined: Fri Jan 31, 2003 8:47 pm
Location: michigan, usa

mysql connection does not error

Post 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.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Have you checked who has what permissions on MySQL?

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

Mac
Rob the R
Forum Contributor
Posts: 128
Joined: Wed Nov 06, 2002 2:25 pm
Location: Houston

Post 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.
Post Reply