data_bits
asked on
How to tell if a MySQL database is available/connectable
I'm trying to automate a way to troubleshoot basic connectivity to mysql databases. Does anyone have a recommended way of doing this that has low impact to the performance of mysql?
I think the existence of mysqld is a good indicator that things are ok. How do I tell the databases are up?
I've run across this query: SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMAT A WHERE SCHEMA_NAME = 'DBName';
But that doesn't necessarily mean the database is available.
I'm teaching myself MySQL as fast as I can but need to jump ahead a few chapters.
TIA!
I think the existence of mysqld is a good indicator that things are ok. How do I tell the databases are up?
I've run across this query: SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMAT
But that doesn't necessarily mean the database is available.
I'm teaching myself MySQL as fast as I can but need to jump ahead a few chapters.
TIA!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you really want to monitor your MySQL server, you can use something like Nagios (requires it's own server/VM) with the check_mysql_health plugin.
It will do much more than just testing if your server is up.
HTH,
Dan
It will do much more than just testing if your server is up.
HTH,
Dan
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
mysql.exe -s -N -h hostname -P 3306 -D databasename -u username -ppassword
For help:
mysql.exe -?
You could write a small sql script and pass it to mysql.exe to test success or not.