I need a way to determine (in a perl script) whether or not mysqld is running and functional. I tried using mysqladmin -utest ping but under windows it does nto set an error whether or not it is successful. Does anyone have any way to do this? TIA.
I'd just use the perl DBI to try to connect to the server. If the connection fails with credentials you have verified to be good (by connecting from the same machine to the same server when you know the server is running), then you can infer that the server is either not running or perhaps you can't reach it through the network.
Unfortunately, nothing is ever simple. I'm not sure what driver to use so I tried mysqlPP. I get "cannot connect" errors whether mydqld is up or not. I'm stumbling around in the dark as this is my first use of DBI. Is there some kind of configuration I need to have done first? Here's my script:
Code:
#!perl -w
use DBI;
my $sqlhnd=DBI->connect("DBI:mysqlPP.apache_auth");
.
.
.
The error is:
DBI connect('apache_auth','',...)failed: Couldn't connect to /tmp/mysql.sock: at C:/OpenSA/perl/site/libDBD/mysqlPP.pm line 109 ...
Thanks but I don't see how that helps me. The only difference is the userid/password. In my case I did not install any to allow users on the host machine to access mysql without one. As I understand it, that means a userid/password is unnecessary in the connect call. If it is required, I have no idea what to use.
I've been searching the forum and it seems the mysql.sock error is pretty common. However, all of the solutions seemed to be for Unix systems. That particular file is in var/lib on Unix so the solution is to create a symbolic link in /tmp.
Unfortunately, under windows there is no such file anywhere. What is going on here? TIA.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.