Cannot connect to MySQL pmm:***@unix(/var/lib/mysql/mysql.sock): Error 1045

I’m adding monitor services according to, but I got errors in the log:

> Cannot connect to MySQL pmm:***@unix(/var/lib/mysql/mysql.sock): Error 1045: Access denied for user ‘pmm’@‘localhost’ (using password: YES)

What can I do to fix it? Thanks.

is the following command working fine?

mysql -S /var/lib/mysql/mysql.sock -upmm -psome-password

please replace some-password by real password.
do you have any special symbols in the password?
what pmm-client version do you use?

pmm-client version: 1.1.2

Yes, the command works fine. No, no special symbols in the password, only [a-z0-9].

It works fine with the root user.

Hi Sam Chen , [LIST=1]
[]Can you paste the full line for pmm-admin add so we can see what options you’re passing?
]Note that if you’ve included --create-user then mysqld_exporter will log into MySQL using the pmm user (as is your case) but with a new, random password. You can see this password with

pmm-admin show-passwords

[]Using this discovered password, can you log into MySQL with pmm user ?
]Are you using tcp or socket, that needs to be included when you did step #1 above, the pmm-admin add command.

Hi Michael Coburn

  1. pmm-admin add mysql --user pmm --password ******** --query-source perfschema --disable-tablestats
  2. Yes, I can see the new, random password
  3. No, I can’t log into MySQL with mysql -S /var/lib/mysql/mysql.sock -upmm -p'random-password-here'
  4. Do you mean I need to specify the --socket parameter when I run pmm-admin add?

Sam Chen , looking at your original error you are attempting to use socket, but the user doesn’t have privileges to log in:


[]Consider using the root account (which should have GRANT option) to authenticate, along with the --create-user option so that pmm user will be created automatically with appropriate permissions
]This will automatically set up pmm-client to use the pmm user appropriately (whether that is by socket or tcp port)
[*]My recommendation is to use this command line:

pmm-admin add mysql --user root --password XXX --create-user --query-source perfschema --disable-tablestats