How to get a list of databases?

It doesn’t appear as though there’s a function available to do this, but you can execute a show databases; query and the rows returned will be the databases available.

EXAMPLE:

Replace this:

$db_list = mysql_list_dbs($link); //mysql 

With this:

$db_list = mysqli_query($link, "SHOW DATABASES"); //mysqli

Leave a Comment