PHP MySQL Functions to list databasesWE can use PHP PDO to list databases existing in MySQL. Here is the query
Using the above query we will develop a PHP PDO script to display all the databases present . Here is the code.
Using MySQLI
This old MySQL extension was deprecated in PHP 5.4.0 and was removed in PHP 7
By using mysql_db_list() function we can get the result set and by using a pointer to this result set we can get the list of all the database. With this and using the code below we can list all the databases hosted on the mysql server. Here is the code, ensure that connection is available to the server.
Use SHOW DATABASE query in place of mysql_db_list().
This article is written by plus2net.com team.
![]() ![]() |