
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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); ?>
- Related Questions & Answers
- How can we delete a MySQL database by using PHP script?
- How can we select a MySQL database by using PHP script?
- How can we write PHP script to count the affected rows by MySQL query?
- How can we write PHP script to release cursor memory associated with MySQL result?
- Write an example to establish MySQL database connection using PHP script?
- How can we create a new database by using PHP script?
- How can we create a MySQL table by using PHP script?
- How can we get the list of tables in a particular database from MySQL Server command line?
- How can we display all the records from MySQL table with the help of PHP script?
- How can we change the default MySQL database to the given database?
- How can we get the list of MySQL server-side help categories?
- How can we create a MySQL temporary table by using PHP script?
- How can we delete an existing MySQL table by using PHP script?
- How can we see the list of views stored in a particular MySQL database?
- How to write PHP script to update an existing MySQL table?
Advertisements