[monitoring-plugins] check_mysql: handle ...
Platon Pronko
git at monitoring-plugins.org
Tue May 30 23:40:12 CEST 2023
Module: monitoring-plugins
Branch: master
Commit: 10863265324a9a9fdf8ce771271af15b7e2f5a4a
Author: Platon Pronko <platon7pronko at gmail.com>
Date: Fri May 19 15:05:02 2023 +0800
URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=1086326
check_mysql: handle ER_ACCESS_DENIED_NO_PASSWORD_ERROR if ignore_auth=1
In some situations MySQL might return ER_ACCESS_DENIED_NO_PASSWORD_ERROR
instead of ER_ACCESS_DENIED_ERROR. Semantically these errors are the same.
---
plugins/check_mysql.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c
index 6cfa70e..91e150f 100644
--- a/plugins/check_mysql.c
+++ b/plugins/check_mysql.c
@@ -138,7 +138,10 @@ main (int argc, char **argv)
mysql_ssl_set(&mysql,key,cert,ca_cert,ca_dir,ciphers);
/* establish a connection to the server and error checking */
if (!mysql_real_connect(&mysql,db_host,db_user,db_pass,db,db_port,db_socket,0)) {
- if (ignore_auth && mysql_errno (&mysql) == ER_ACCESS_DENIED_ERROR)
+ /* Depending on internally-selected auth plugin MySQL might return */
+ /* ER_ACCESS_DENIED_NO_PASSWORD_ERROR or ER_ACCESS_DENIED_ERROR. */
+ /* Semantically these errors are the same. */
+ if (ignore_auth && (mysql_errno (&mysql) == ER_ACCESS_DENIED_ERROR || mysql_errno (&mysql) == ER_ACCESS_DENIED_NO_PASSWORD_ERROR))
{
printf("MySQL OK - Version: %s (protocol %d)\n",
mysql_get_server_info(&mysql),
More information about the Commits
mailing list