Description
This function lists a page's databases.
Examples
LiveAPI PHP Class
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
$list_databases = $cpanel->api1('Mysql','listdbs'); // Call the function.
LiveAPI Perl Module
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
my $list_databases = $cpliveapi->api1('Mysql','listdbs'); # Call the function.
cPanel Tag System (deprecated)
Warning:
In cPanel & WHM version 11.30 and later, cPanel tags are deprecated. This example is present in order to help developers move from the old cPanel tag system to our LiveAPI.
We strongly recommend that you only use the LiveAPI system to call the cPanel APIs.
<cpanel Module="Mysql::listdbs()">
Output (HTML)
<b>cpuser_db</b><a
href="deldb.html?db=cpuser_db"><img
src="/frontend/x3/images/delete.jpg" border="0" alt=""
/></a><a href="checkdb.html?db=cpuser_db"><img
src="/frontend/x3/images/mysqlcheck.gif" border="0" alt=""
/></a><a href="repairdb.html?db=cpuser_db"><img
src="/frontend/x3/images/mysqlrepair.gif" border="0" alt=""
/></a><blockquote><u>Users in db</u><br
/>
cpuser_dbuser
(Privileges: SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES,
INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, CREATE ROUTINE)
<a
href="deluserfromdb.html?db=cpuser_db&user=cpuser_dbuser"><img
src="/frontend/x3/images/delete.jpg" border=0></a>
<br />
<blockquote>
<table>
<tr>
<td colspan=2><b>Connection Strings</b></td>
</tr>
<tr>
<td><b>Perl</b></td>
<td><i><font
size=-1>$dbh =
DBI->connect("DBI:mysql:cpuser_db:localhost",<br
/>"cpuser_dbuser","<PASSWORD
HERE>");</i></font></td>
</tr>
<tr>
<td><b>PHP</b></td>
<td><i><font
size=-1>$dbh=mysql_connect ("localhost", "cpuser_dbuser",<br
/>"<PASSWORD HERE>") or die('Cannot connect to the
database because: ' . mysql_error());<br />mysql_select_db
("cpuser_db");</font></i></td>
</tr>
</table>
</blockquote>
</blockquote><br
/><b>cpuser_db2</b><a
href="deldb.html?db=cpuser_db2"><img
src="/frontend/x3/images/delete.jpg" border="0" alt=""
/></a><a href="checkdb.html?db=cpuser_db2"><img
src="/frontend/x3/images/mysqlcheck.gif" border="0" alt=""
/></a><a href="repairdb.html?db=cpuser_db2"><img
src="/frontend/x3/images/mysqlrepair.gif" border="0" alt=""
/></a></blockquote><br />
Parameters
This function does not accept parameters.
Returns
This function returns HTML with the page's database information.