How to check a connection to MySQL db is not dead, and avoid unnecessarily (close and) re-create connection? Say, I am creating and using the connection in a Bash script.
Edit
By "dead" i mean, perhaps the last time when a created connection was used is 1 hr ago, and on the server side, perhaps it does something to kill off inactive connections in some way.