A test for MySQL database connectivity is done using the PHP script mentioned below. It results in showing the tablet names that exist within the specified database.

Sample Script

    <!--?
$connect=mysql_connect("dbserver","dbuser","dbpassword") or die("Unable to Connect");
mysql_select_db("dbname") or die("Could not open the db");
$showtablequery="SHOW TABLES FROM dbname";
$query_result=mysql_query($showtablequery);
while($showtablerow = mysql_fetch_array($query_result))
{
echo $showtablerow[0]." ";
} 
?-->

Here is some of the clarification of the variables used in the script above:

Step 1. dbserver: Linux hosting’s (cPanel) value as localhost needs to be noted. The MySQL Server IP should be added for windows hosting.

Step 2. dbname: mention the entire database name along with the prefix such as reseloaq_mysql.

Step 3. dbuser: Specify the database user as well.

Step 4. dbpassword: Specify the database user’s password. 

I hope everything was clear and easy to understand. Please get in touch with the bodHOST support team as soon as possible with any questions.

Read Also: How to Connect Plesk with External Database Servers

Popular Posts You May Read

Explore more hosting insights, tips and industry updates.

CSF is Blocking Your IP? Here’s What You Can Do?

Generally, considered to be an advanced firewall, CSF blocks external IPs (Inbound Connections) to avoid…

Virtual switches in Hyper-V

i. Summaryii. Virtual Switch Typesiii. Virtual Switch Creationiv. Extensionsv. Address Range of MAC Summary In…

How to Edit the Hosts File in Windows, macOS, and Linux

How to Edit the Hosts File in Windows, macOS, and Linux

In this guide, you will discover how to easily edit the host file across Windows,…