Ad Widget

Collapse

Access denied for user 'zabbix'@'localhost' (using password: NO)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • davede
    Junior Member
    • Nov 2020
    • 2

    #1

    Access denied for user 'zabbix'@'localhost' (using password: NO)

    Good evening,

    I am new to Zabbix and I have not so much experience with Linux, however I have tried to install the Zabbix 5.0 on my tinypc form Zotac (CI329 Barebone nano) and something went wrong. I was able to install the software on the device, on Ubuntu Server 20.04 and I am also able to log into the Zabbix's dashboard. However I cannot use it because on the home screen I can see an information, that zabbix server is running: no.

    So I was searching and searching, but I didn't find a right solution for me. I have checked logs and inside of them I can see:

    HTML Code:
    : 1591:20201119:192323.519 Starting Zabbix Server. Zabbix 5.0.5 (revision eaa427cf19).
    1591:20201119:192323.519 ****** Enabled features ******
    1591:20201119:192323.519 SNMP monitoring: YES
    1591:20201119:192323.519 IPMI monitoring: YES
    1591:20201119:192323.519 Web monitoring: YES
    1591:20201119:192323.519 VMware monitoring: YES
    1591:20201119:192323.519 SMTP authentication: YES
    1591:20201119:192323.519 ODBC: YES
    1591:20201119:192323.519 SSH support: YES
    1591:20201119:192323.519 IPv6 support: YES
    1591:20201119:192323.519 TLS support: YES
    1591:20201119:192323.519 ******************************
    1591:20201119:192323.519 using configuration file: /etc/zabbix/zabbix_server.conf
    1591:20201119:192323.535 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: NO)
    1591:20201119:192323.535 database is down: reconnecting in 10 seconds
    1591:20201119:192333.537 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: NO)
    1591:20201119:192333.537 database is down: reconnecting in 10 seconds
    1591:20201119:192343.538 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: NO)
    1591:20201119:192343.539 database is down: reconnecting in 10 seconds
    1591:20201119:192353.540 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: NO)
    1591:20201119:192353.540 database is down: reconnecting in 10 seconds
    1591:20201119:192403.541 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: NO)
    1591:20201119:192403.542 database is down: reconnecting in 10 seconds
    1591:20201119:192413.543 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: NO)
    1591:20201119:192413.543 database is down: reconnecting in 10 seconds
    1591:20201119:192423.545 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: NO)
    1591:20201119:192423.545 database is down: reconnecting in 10 seconds
    1591:20201119:192433.546 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: NO)
    1591:20201119:192433.546 database is down: reconnecting in 10 seconds
    1591:20201119:192443.548 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: NO)
    1591:20201119:192443.548 database is down: reconnecting in 10 seconds
    1591:20201119:192453.550 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: NO)
    1591:20201119:192453.550 database is down: reconnecting in 10 seconds
    1591:20201119:192503.551 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: NO)
    1591:20201119:192503.551 database is down: reconnecting in 10 seconds
    so I have checked also the configuration under /etc/zabbix in zabbix_server.conf and this is the thing that I do not understand, because I am providing a simple password that I use on this machine everywhere (it is just a test machine so I do not care about it) but somehow it will not work. I thought it could be also related with privileges in database, but:


    HTML Code:
    mysql> show GRANTS FOR 'zabbix'@'localhost';
    +------------------------------------------------------------+
    | Grants for zabbix@localhost |
    +------------------------------------------------------------+
    | GRANT USAGE ON *.* TO `zabbix`@`localhost` |
    | GRANT ALL PRIVILEGES ON `zabbix`.* TO `zabbix`@`localhost` |
    +------------------------------------------------------------+
    2 rows in set (0.00 sec)
    zabbix is a username and the name of database.

    How can I solve the problem? Can you help me please?
  • tim.mooney
    Senior Member
    • Dec 2012
    • 1427

    #2
    What version of MySQL are you using?

    The privileges look reasonable, I don't think that's the issue.

    You've indicated that the web front end is working fine, which means that the database connection parameters you've set in the zabbix/conf/zabbix.conf.php (probably /usr/share/zabbix/conf/zabbix.conf.php) are suitable for accessing the database.

    If the web front end can connect to the database running on localhost but the zabbix_serverd processes can't, the most likely problem is an issue with one of the DB* related parameters in /etc/zabbix/zabbix_server.conf. Have you verified that
    1. DBName from /etc/zabbix/zabbix_server.conf matches the value (but without quotes) for $DB['DATABASE'] from zabbix/conf/zabbix.conf.php ?
    2. DBUser from /etc/zabbix/zabbix_server.conf matches the value (but without quotes) for $DB['USER'] from zabbix/conf/zabbix.conf.php ?
    3. DBPassword from /etc/zabbix/zabbix_xerver.conf matches the value (but without quotes) for $DB['PASSWORD'] from zabbix/conf/zabbix.conf.php ?
    4. are any of your other database-related connection parameters (DBHost, DBSocket, DBPort) uncommented in /etc/zabbix/zabbix_server.conf ? For a MySQL database running on the same system, I would expect all 3 of those parameters are probably commented out, but if not, please share how they are set.

    Comment

    • davede
      Junior Member
      • Nov 2020
      • 2

      #3
      Hey tim.mooney thank you for your reply!

      Originally posted by tim.mooney
      What version of MySQL are you using?
      mysql Ver 8.0.22-0ubuntu0.20.04.2 for Linux on x86_64 ((Ubuntu))

      1. 2. 3. yes I compared the details in zabbix_server.conf (are with quotes) and zabbix.conf.php (are without quotes) and they are the same. I use zabbix for a name of database and username too.

      4.
      a) DBHost=localhost but it is with # commented.
      b) DBSocket= (has no value) but it is commented.
      c) DBPort= (has no value) and it is also commented.

      May it be useful but I have followed this tutorial to install zabbix. I just setup my tinypc for it, installed ubuntu server with openssh server and after downloading the updates I installed Zabbix.
      Last edited by davede; 22-11-2020, 16:38.

      Comment

      • tim.mooney
        Senior Member
        • Dec 2012
        • 1427

        #4
        All the settings you've mentioned sound correct. You've eliminated most of the common issues that might cause authentication problems.

        The next thing I would investigate is whether it has something to do with the authentication changes at MySQL 8.0.

        You don't need to report the output (the full output contains the encrypted password, don't share that), but if you connect via the 'mysql' command line client as the mysql root user and issue the command

        Code:
        > SHOW CREATE USER 'zabbix'@'localhost';
        does the output contain "IDENTIFIED WITH caching_sha2_password" ?

        Also, while you're connected as the mysql root user, what does the following command output:

        Code:
        > SHOW VARIABLES LIKE '%plugin%';
        I'm just trying to determine if the 'caching_sha2_password' plugin is in play, and if the problem may relate to that.

        Comment

        • wouter viroux
          Junior Member
          • Sep 2021
          • 2

          #5
          When I check

          > SHOW CREATE USER 'zabbix'@'localhost';
          it does contain "IDENTIFIED WITH caching_sha2_password"

          mysql> SHOW VARIABLES LIKE '%plugin%';
          +-----------------------------------------------+------------------------+
          | Variable_name | Value |
          +-----------------------------------------------+------------------------+
          | default_authentication_plugin | caching_sha2_password |
          | plugin_dir | /usr/lib/mysql/plugin/ |
          | replication_optimize_for_static_plugin_config | OFF |
          +-----------------------------------------------+------------------------+
          3 rows in set (0.03 sec)

          So I'm not sure what I should do..

          Comment

          • tim.mooney
            Senior Member
            • Dec 2012
            • 1427

            #6
            Hi Wouter!

            You probably should have started a new thread, but that's fine.

            The help I was trying to offer to davede was related to how authenticating to MySQL changed at the 8.0 and later. He (or she) had already eliminated many of the more common reasons why a connection to MySQL would fail for zabbix-server. I was only speculating that the problem might be related to that change.

            Have you verified that DBName, DBuser, and DBPassword are set correctly in the Zabbix server config file, as discussed in post #2 and post #3 in this thread?

            If you type the following command on the command line of your zabbix server:

            Code:
             mysql -u zabbix -h localhost --database=zabbix -p
            and then you enter the password you set up for the 'zabbix' database user, can you successfully connect? If you do successfully authenticate, you can just type "exit" at the mysql prompt to disconnect. If you can connect this way, it will verify that the user and password are correct.

            If you report the answers to these questions, that will probably point us in a direction for further steps to try to debug the problem.

            Comment

            • dunnsland
              Member
              • Dec 2021
              • 81

              #7
              wouter viroux
              Is this issue resolved?

              I am seeing exactly the same issue as described above. I can connect to the database with the username and allocated password. So connectivity is not an issue. What I do not understand is why the item is connecting with NO password.

              As you can see in the image below, if I try with no password then the connection fails, which is correct. If I use a password then I gain access.

              Click image for larger version  Name:	mysql_connection.png Views:	0 Size:	71.4 KB ID:	438132

              My question is, why is the item trying to run the test against the database without a password. How can I see this?
              below is an extract from the zabbix_server.log file.

              # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
              2954986:20220113:224818.199 opid:58348 step:1 type:11 params:'/resultset/row[field/text()='Threads_connected']/field[@name='Value']/text()' error_handler:0 error_handler_params:''
              2954986:20220113:224818.199 tags:
              2954986:20220113:224818.199 tagid:4481 tag:'Application' value:'MySQL'
              2954986:20220113:224818.199 itemid:34483 hostid:10084 key:'mysql.threads_created'
              2954986:20220113:224818.199 type:18 value_type:3
              2954986:20220113:224818.199 interfaceid:0
              2954986:20220113:224818.199 state:1 error:'Preprocessing failed for: ERROR 1045 (28000): Access denied for user 'zabbix'@'localhost' (using password: NO)
              1. Failed: cannot extract XML value with xpath "/resultset/row[field/text()='Threads_created']/field[@name='Value']/text()": cannot parse xml value: Start tag expected, '<' not found'
              2954986:20220113:224818.199 flags:0 status:0
              # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

              Thanks
              Lawrence

              Comment

              • faroa
                Junior Member
                • Apr 2022
                • 2

                #8
                3107:20220411:153733.178 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: NO)

                3107:20220411:153733.178 database is down: reconnecting in 10 seconds

                Helpme

                Comment

                • faroa
                  Junior Member
                  • Apr 2022
                  • 2

                  #9
                  https://stackoverflow.com/questions/...not-be-current

                  Comment

                  • hiperteckppta
                    Junior Member
                    • Oct 2022
                    • 1

                    #10
                    ola boa tarde estou com mesmo poblema sabe o que pode ser?

                    Comment

                    Working...