Show List of Database

Posted: December 20, 2012 in Mysql

<?php
$con = mysql_connect(“localhost”, “root”, “”);
if (!$con)
{
die(‘Could not connect: ‘ . mysql_error());
}

$db_list = mysql_list_dbs($con);

while ($db = mysql_fetch_object($db_list))
{
echo $db->Database . “<br />”;
}
mysql_close($con);
?>

Please try it in your localhost

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s