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

  • Filter
  • Time
  • Show
Clear All
new posts

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

    I'm adding monitor services according to https://www.percona.com/doc/percona-...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.

  • #2
    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?


    • #3
      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.


      • #4
        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.


        • #5
          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`?


          • #6
            Sam Chen , looking at your original error you are attempting to use socket, but the user doesn't have privileges to log in:
            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