pmm-admin add mysql - invalid username or password

Hello,
I’m trying to add mysql monitoring:
sudo pmm-admin add mysql --query-source=perfschema --username=XXX --password=XXX --debug

Username/password are correct, I can login to mysql locally, to 127.0.0.1.

But I always get: “Invalid username or password. Please check username and password.”

Is there any special mysql role I need to add to the user? Or may be there’s some firewall issue I’m not aware of?

​​​​​​​Regards​​​​​​​

Hello, could you check your CREATE USER statement for pmm? PMM2 is sensitive for difference between localhost and 127.0.0.1
For example my pmm_user statements are:

CREATE USER pmm_user'@'127.0.0.1 IDENTIFIED BY pmm_password;
GRANT SELECT, PROCESS, SUPER, REPLICATION CLIENT, RELOAD ON *.* TO pmm_user'@'127.0.0.1 WITH MAX_USER_CONNECTIONS 10;
GRANT SELECT, UPDATE, DELETE, DROP ON performance_schema.* TO pmm_user'@'127.0.0.1;

Added these grants, still doesn’t work. Debug output is the following:
DEBUG 2019-12-04 13:26:11.438438107Z: POST /v1/management/MySQL/Add HTTP/1.1
Host: XXX:443
User-Agent: Go-http-client/1.1
Content-Length: 291
Accept: application/json
Authorization: Basic YWRtaW46YWRtaW4=
Content-Type: application/json
Accept-Encoding: gzip

{“address”:“127.0.0.1”,“max_slowlog_file_size”:“0”,“node_id”:"/node_id/59474a06-80ab-4819-8a4a-787d52e8fdf0",“password”:“XXX”,“pmm_agent_id”:"/agent_id/6590d7c2-db64-4793-88ec-0edad86dc472",“port”:3306,“qan_mysql_slowlog”:true,“service_name”:“XXX-mysql”,“username”:“pmm”}

DEBUG 2019-12-04 13:26:11.591946912Z: HTTP/1.1 401 Unauthorized
Content-Length: 92
Connection: keep-alive
Content-Type: application/json
Date: Wed, 04 Dec 2019 13:26:11 GMT
Server: nginx

{“code”:16,“error”:“Invalid username or password”,“message”:“Invalid username or password”}

DEBUG 2019-12-04 13:26:11.592128639Z: Result:
DEBUG 2019-12-04 13:26:11.592170075Z: Error: &my_sql.AddMySQLDefault{_statusCode:401, Payload:(*my_sql.AddMySQLDefaultBody)(0xc000508480)}
Invalid username or password. Please check username and password.

As I can see you are Unauthorized on pmm-server side. You need to specify admin user and admin password from PMM Server on config stage.

pmm-admin config 10.10.10.10 generic best_db_name --server-insecure-tls --server-url=http://admin_user:admin_apssword@pmm.com/

Ok, I got this working! In PMM Inventory I can see MySQL service. But nothing is displayed in mysql dashboards :frowning: Been trying to find next steps in online docs/blogs, but couldn’t.

could you share output of?

pmm-admin list

Also you can open url, but you should be logged in as admin.

your-pmm-server-domain.com/prometheus/targets

There you can find all connected agent to PMM Server and their status. It can provide more information.