I have encountered a "hidden database" issue with mod_php, apache2 and
mySQL that I have thus far been unable to resolve.
I am able to connect to the mysql socket using mysql_connect, but then find that mysql_list_dbs only returns the "test" database. This *sounded* like an issue with the SHOW DATABASES privilege until I found I was able to log in to the same MySQL server *as the same user* with the provided command-line client (mysql) and SHOW DATABASES would display all the other databases on this system.
Furthermore, I tried connecting as root, and again found only the "test" database was visible to PHP. If I dropped the test database, no databases were visible to PHP (regardless of how many databases were visible using SHOW DATABASES). If I created "test", "tester", "testing", "hello" etc, then the "test" database would reappear to PHP, but no other databases were visible.
I also tried to connect PHP to MySQL as a super-user, and encountered the exact same issue.
Steps to confirm question: 1) Connect using php, drop 'test' database.
2) Confirm php no longer sees 'test' database.
3) Connect using mysql client, confirm test database is missing.
4) -----\
4a) if so, check mysql database to confirm permissions for root include '%' databases and not just 'test'.
4b) if not, change php code to connect to correct mysql server.
Apologies that this may not be very useful, but your problem is extremely odd - if it's *not* a permissions / database error.
Cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital.
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php