Child pages
  • cPanel API 1 Functions - Mysql::listdbs
Skip to end of metadata
Go to start of metadata

Description


This function lists a page's databases.

Warning:

  • We removed this function in cPanel & WHM version 70.
  • cPanel API 1 is deprecated. Do not use this function. Instead, we strongly recommend that you use the following newer functions:

Examples


 LiveAPI PHP Class
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
$list_databases = $cpanel->api1('Mysql','listdbs'); // Call the function.


Note:

For more information, read our Guide to the LiveAPI System.

 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.


Note:

For more information, read our Guide to the LiveAPI System.

 cPanel Tag System (deprecated)


Warning:

In cPanel & WHM version 11.30 and later, cPanel tags are deprecated. We provide this example to help developers move from the old cPanel tag system to our LiveAPI system. We strongly recommend that you only use the LiveAPI system to call the cPanel APIs.

<cpanel Module="Mysql::listdbs()">
 Command Line
cpapi1 --user=username Mysql listdbs


Notes:

  • You must URI-encode these values.
  • username represents your account-level username.
  • For more information and additional output options, read our Guide to cPanel API 1 documentation or run the cpapi1 --help command. 

 Output (HTML)
<b>cpuser_db</b><a
 href="deldb.html?db=cpuser_db"><img 
src="/frontend/paper_lantern/images/delete.jpg" border="0" alt="" 
/></a><a href="checkdb.html?db=cpuser_db"><img 
src="/frontend/paper_lantern/images/mysqlcheck.gif" border="0" alt="" 
/></a><a href="repairdb.html?db=cpuser_db"><img 
src="/frontend/paper_lantern/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/paper_lantern/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","&lt;PASSWORD 
HERE&gt;");</i></font></td> 
 </tr> 
 <tr> 
 <td><b>PHP</b></td> 
 <td><i><font
 size=-1>$dbh=mysql_connect ("localhost", "cpuser_dbuser",<br 
/>"&lt;PASSWORD HERE&gt;") 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/paper_lantern/images/delete.jpg" border="0" alt="" 
/></a><a href="checkdb.html?db=cpuser_db2"><img 
src="/frontend/paper_lantern/images/mysqlcheck.gif" border="0" alt="" 
/></a><a href="repairdb.html?db=cpuser_db2"><img 
src="/frontend/paper_lantern/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.