Not the answer you need?
Register and ask your own question!

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

Sam ChenSam Chen EntrantInactive User Role Beginner
I'm adding monitor services according to https://www.percona.com/doc/percona-monitoring-and-management/faq.html#what-privileges-are-required-to-monitor-a-mysql-instance, 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.

Comments

  • MykolaMykola Percona Percona Staff Role
    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?
  • Sam ChenSam Chen Entrant Inactive User Role Beginner
    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.
  • Michael CoburnMichael Coburn Principal Architect, Percona Percona Staff Role
    Hi Sam Chen ,
    1. Can you paste the full line for pmm-admin add so we can see what options you're passing?
    2. 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
      
    3. Using this discovered password, can you log into MySQL with pmm user ?
    4. Are you using tcp or socket, that needs to be included when you did step #1 above, the pmm-admin add command.
  • Sam ChenSam Chen Entrant Inactive User Role Beginner
    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`?
  • Michael CoburnMichael Coburn Principal Architect, Percona Percona Staff Role
    Sam Chen , looking at your original error you are attempting to use socket, but the user doesn't have privileges to log in:
    pmm:***@unix(/var/lib/mysql/mysql.sock)
    
    1. 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
    2. This will automatically set up pmm-client to use the pmm user appropriately (whether that is by socket or tcp port)
    3. My recommendation is to use this command line:
    pmm-admin add mysql --user root --password XXX --create-user --query-source perfschema --disable-tablestats
    
Sign In or Register to comment.

MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright ©2005 - 2020 Percona LLC. All rights reserved.