PHP 4.0 Bug #9601 Updated: MySQL connects to wrong database

From: Date: Tue, 10 Apr 2001 14:52:04 +0000
Subject: PHP 4.0 Bug #9601 Updated: MySQL connects to wrong database
Groups: php.dev 
Request: Send a blank email to php-dev+get-51348@lists.php.net to get a copy of this message
ID: 9601 Updated by: sniper Reported By: gkopp@ideastar.com Old-Status: Feedback Status: Closed Bug Type: MySQL related Assigned To: Comments: No feedback. If this happens also with soon to be released PHP 4.0.5, reopen this bug report. --Jani Previous Comments: --------------------------------------------------------------------------- [2001-03-07 12:58:59] cnewbill@php.net Okay. Can anybody else comment on this? All the machines I use have newer versions of both MySQL and PHP. They also work for this situation. You may still want to try the --with-mysql=/path/to/mysql recompile if you can, and while you are recompiling grab the latest snapshot of PHP from http://snaps.php.net. -Chris --------------------------------------------------------------------------- [2001-03-07 12:13:05] gkopp@ideastar.com The grant tables are fine. Perhaps we misunderstood ourselves. If I use "mysql" to connect to the live database using a user name and password that is in the grant tables, it works fine. If I use "mysql" to connect to the test database using a user name and password that DOES NOT HAVE PRIVILEGES to this database, authentication fails, as it should. If I use PHP to connect to the live database using a user name and password that is in the grant tables, it works fine. If I use PHP to connect to the test database using the SAME user name and password that works for the live database, it connects to the LIVE database instead of the test database. We found this by accident when setting up a test web site that duplicates a live site. When I changed the database name in the connection object, it didn't fail, it just connected to the live database. --------------------------------------------------------------------------- [2001-03-07 10:59:54] cnewbill@php.net USER NOTES FROM EMAIL: I just used --with-mysql AND ERROR 1045: Access denied for user: 'ceresdb@localhost' (Using password: YES) When executing the mysql command from a bash shell. Greg --------------------------------------------------------------------------- [2001-03-07 10:59:01] cnewbill@php.net Please use the bug system when replying. Thanx. Well it looks like you don't have the Grant Tables setup properly OR you didn't flush them after changing them. Do a mysqladmin reload and try again, if it still doesn't connect then you need to fix your grant tables. See http://www.mysql.com/documentation/index.html for information on how to do this. I haven't seen it cause any problems, but just to be safe you should recompile PHP using --with-mysql=/path/to/mysql so PHP is aware of what version you are actually using. If for some reason your grant tables are not the problem simply reopen this report. -Chris --------------------------------------------------------------------------- [2001-03-07 10:45:31] cnewbill@php.net Couple stupid questions. 1) When you compiled PHP, did you just use --with-mysql instead of --with-mysql=/path/to/mysql? 2) Does the mysql command line tool connect? i.e. mysql -u ceres -pxxxx ceres_test -Chris --------------------------------------------------------------------------- The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online. ATTENTION! Do NOT reply to this email! To reply, use the web interface found at http://bugs.php.net/?id=9601&edit=2

« previous php.dev (#51348) next »