php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30311 mysql can't find databases
Submitted: 2004-10-02 20:22 UTC Modified: 2004-10-03 14:54 UTC
From: alex at avannaproductions dot com Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 5.0.2 OS: MacOS X 10.3
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: alex at avannaproductions dot com
New email:
PHP Version: OS:

 

 [2004-10-02 20:22 UTC] alex at avannaproductions dot com
Description:
------------
I have PHP 5.0.2 and MySQL 4.1.4 installed. Both mysql 
and mysqli extensions are enabled. Currently I have 5 
databases created. However, when I try to access them 
through PHP, mysql seems to think there is only 1, 
whereas mysqli finds all 5. I originally noticed this 
when I suddenly could no longer select a db I wanted 
with mysql. Upon investigating further, I came up with 
the following reproduce code that fails to find more 
than 1 db using mysql in either of 2 different methods. 
Then succeeds in finding all 5 with mysqli.

Configure option: --with-mysql=/usr/local/mysql --with-
mysqli=/usr/local/mysql/bin/mysql_config

Reproduce code:
---------------
$db=mysql_connect("HOST","USER","PASSWORD");
$db_list=mysql_list_dbs($db);
$count=mysql_num_rows($db_list);
for($i=0;$i<$count;$i++) echo mysql_db_name($db_list,$i)."<br>";

echo "----<br>";

$db=mysql_connect("HOST","USER","PASSWORD");
$res=mysql_query("SHOW DATABASES;");
if ($res) while ($res2=mysql_fetch_assoc($res)) echo $res2["Database"]."<br>";

echo "----<br>";

$db=new mysqli("HOST","USER","PASSWORD","ANY DB");
$res=$db->query("SHOW DATABASES;");
if ($res) while ($res2=$res->fetch_assoc()) echo $res2["Database"]."<br>";

Expected result:
----------------
db 1
db 2
db 3
...
----
db 1
db 2
db 3
...
----
db 1
db 2
db 3
...

Actual result:
--------------
db 4
----
db 4
----
db 1
db 2
db 3
...

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-10-03 14:54 UTC] derick@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

.
 [2004-10-03 19:54 UTC] alex at sirensclef dot com
I'm not clear as to why this does not imply a bug. It 
worked in 5.0.1, then I upgraded to 5.0.2 and it stopped 
working. A site I am developing ceases to work because 
of this issue, since I cannot access the database I was 
using. I hadn't changed any of the code that worked 
under 5.0.1 and nothing changed with my mysql install. I 
don't see it as a bug with mysql because when I connect 
to the mysql server via command line, it lists all the 
databases just fine. I hope this is resolved somehow all 
the same...
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 02:01:29 2024 UTC