How to check mysql service status from website?

May I know is there any way to check mysql service status for my website?

eg for php, we can use phpinfo()…

You cannot check the mysql service status directly from the particular web site. However, you can check it by login to your server. If you do not have an access to your server where your domain is actually hosted then you will need to contact your server administrator.

Ok, got it!

Thanks for your reply :slight_smile:

Hi,

You can use this little script on your server/hosting:

<?php
$db_host = "localhost";
$db_username = "root";
$db_password = "";

$conn = @mysql_connect($db_host, $db_username, $db_password);

if (!$conn)
{
        die ("MySQL is Down due to: " . mysql_error());
}

echo "Connected to MySQL!";
mysql_close($conn);
?>

Thanks.

Thanks for your sharing Tapan…

At least I can know what’s the problem with the connection this time :slight_smile: