I am using the following code in a Kubernetes application to probe MySQL's readiness:
handler := corev1.Handler{
Exec: &corev1.ExecAction{
Command: []string{"cat", fmt.Sprintf("%v/mysqld.pid", dataDir)},
},
}
It works better than probing TCP port 3306, which will generate a lot of error info in mysql-error.log like this: [Note] Got an error reading communication packets
My question is: Is mysqld.pid file 's existance enough to prove that MySQL server is ready to serve ?