Ad Widget

Collapse

[Z3001] connection to database 'zabbix' failed:

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ssjg2004_01
    Junior Member
    • Jan 2023
    • 4

    #1

    [Z3001] connection to database 'zabbix' failed:

    Hi All,

    Just spinning up a new instance of Zabbix 6.2

    All has gone ok, ran through the GUI connecting to the DB (Remote Azure Flex Server for MySQL) all no issues.

    From the Zabbix Server I can connect to MySQL:

    zabbixadmin@xxxxxduks-0001:/var/log/zabbix$ mysql --host xxxxxxxxxxxx.mysql.database.azure.com --database xxxxx_db --user xxxxxx_dbuser -p
    Enter password:
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A

    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 11823
    Server version: 8.0.28 Source distribution

    Copyright (c) 2000, 2022, Oracle and/or its affiliates.

    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.

    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

    mysql>


    Howwever when I try and start the Zabbix Server 'sudo service zabbix-server start' i get the following the Zabbix_Server.log

    541707:20230112:212955.019 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
    541707:20230112:212955.019 database is down: reconnecting in 10 seconds

    ​my zabbix.conf.php is as follows:

    $DB['TYPE'] = 'MYSQL';
    $DB['SERVER'] = 'xxxxxxxx.mysql.database.azure.com';
    $DB['PORT'] = '3306';
    $DB['DATABASE'] = 'xxxxxx_db';
    $DB['USER'] = 'xxxxxx_dbuser';
    $DB['PASSWORD'] = 'xxxxxxxxxxxxxxxxxxxxx';

    ​Could any of you very knowledgeable kind people suggest anything or pass me in the right direction?

    Many Thanks
    Si
  • Answer selected by ssjg2004_01 at 13-01-2023, 16:30.
    ssjg2004_01
    Junior Member
    • Jan 2023
    • 4

    Resolved this now ... Zabbix didnt have permission to read /etc/zabbix/zabbix_server.conf..

    Came straight up after giving it permission!

    Comment

    • Atsushi
      Senior Member
      • Aug 2013
      • 2028

      #2
      zabbix.conf.php is the web frontend configuration. For zabbix_server settings, check the settings in /etc/zabbix/zabbix_server.conf.

      Comment

      • ssjg2004_01
        Junior Member
        • Jan 2023
        • 4

        #3
        Hi Atsushi,

        Many thanks for your reply. I have the following in my zabbix_server.conf

        ListenPort=10051
        LogFile=/var/log/zabbix/zabbix_server.log
        LogFileSize=0
        DBHost=xxxx.mysql.database.azure.com
        DBName=xxxx_db
        DBUser=xxxx_dbuser
        DBPassword=xxxxxxxxxxxxxxxxxxxx
        DBPort=3306​

        Many Thanks
        Si
        Last edited by ssjg2004_01; 13-01-2023, 12:37.

        Comment

        • ssjg2004_01
          Junior Member
          • Jan 2023
          • 4

          #4
          Hi,

          I also noticed in the zabbix.conf.php i have:

          $DB['ENCRYPTION'] = true;
          $DB['VERIFY_HOST'] = false;​

          I have now also added DBTLSConnect=required

          That's not worked either

          Cheers!
          Last edited by ssjg2004_01; 13-01-2023, 14:07.

          Comment

          • ssjg2004_01
            Junior Member
            • Jan 2023
            • 4

            #5
            Resolved this now ... Zabbix didnt have permission to read /etc/zabbix/zabbix_server.conf..

            Came straight up after giving it permission!

            Comment

            Working...