Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is MySQL up question

Status
Not open for further replies.

awingnut

Programmer
Feb 24, 2003
759
US
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.

Want the best answers? Ask the best questions: TANSTAAFL!
 
Thanks for the reply.

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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top