#30311 [Com]: mysql can't find databases
| From: | alex at sirensclef dot com | Date: | Sun, 03 Oct 2004 17:54:39 +0000 |
| Subject: | #30311 [Com]: mysql can't find databases | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-67052@lists.php.net to get a copy of this message | ||
ID: 30311
Comment by: alex at sirensclef dot com
Reported By: alex at avannaproductions dot com
Status: Bogus
Bug Type: MySQL related
Operating System: MacOS X 10.3
PHP Version: 5.0.2
New Comment:
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...
Previous Comments:
------------------------------------------------------------------------
[2004-10-03 14:54:45] 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-02 20:22:52] 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
...
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30311&edit=1