Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
How can we write PHP script to get the list of MySQL database?
We can write the following PHP script to get the list of available MySQL databases −
Example
<?php
$con = mysql_connect("localhost", "userid", "password");
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);
?> Advertisements
