mysqld_exporter icon indicating copy to clipboard operation
mysqld_exporter copied to clipboard

mysql passwords with # and ;

Open aliensmily opened this issue 5 years ago • 1 comments

Host operating system: output of uname -a

Linux gisu665 4.4.175-94.79-default #1 SMP Thu Feb 21 16:03:55 UTC 2019 (047a6d3) x86_64 x86_64 x86_64 GNU/Linux => SUSE Linux Enterprise Server 12 (x86_64) VERSION = 12 PATCHLEVEL = 3

mysqld_exporter version: output of mysqld_exporter --version

mysqld_exporter, version 0.11.0 (branch: HEAD, revision: 5d7179615695a61ecc3b5bf90a2a7c76a9592cdd) build user: root@3d3ff666b0e4 build date: 20180629-15:00:35 go version: go1.10.3

MySQL server version

8.0.13 MySQL Community Server

mysqld_exporter command line flags

/opt/mysql/product/exporters/mysqld_exporter --config.my-cnf=/home/mysqladm/.myMOND.cnf

cat /home/mysqladm/.myMOND.cnf

# Password in "
# Password contains ; and #
[client]
socket=/opt/mysql/admin/mond/config/mysql.sock
user=MON_NOCMONITOR
password=****

What did you do that produced an error?

Starting the exporter with systemctl.

What did you expect to see?

The option file is working fine when using mysql on shell.

mysqladm@host0815:~> mysql --defaults-file=/home/mysqladm/.myMOND.cnf --print-defaults
mysql would have been started with the following arguments:
--socket=/opt/mysql/admin/mond/config/mysql.sock --user=MON_NOCMONITOR --password=*****
mysqladm@host0815:~> mysql --defaults-file=/home/mysqladm/.myMOND.cnf
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2294
Server version: 8.0.13 MySQL Community Server - GPL

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

(MON_NOCMONITOR@localhost) [(none)]> \q

What did you see instead?

Error-Msg: Mar 29 15:51:27 host0815 mysqld_exporter[108908]: time="2019-03-29T15:51:27+01:00" level=error msg="Error pinging mysqld: Error 1045: Benutzer 'MON_NOCMONITOR'@'localhost' hat keine Zugriffsberechti gung (verwendetes Passwort: Ja)" source="exporter.go:119"

Workaround: Changing the password to an password without # and ; worked for the exporter. Parsing problem? Is this known behaviour?

aliensmily avatar Mar 29 '19 15:03 aliensmily

Yes, there are known parsing problems with some valid password characters. There is an open issue about changing how the connection string is handled to help with this. But I have not had time to work on it.

SuperQ avatar Mar 30 '19 11:03 SuperQ