Ad Widget

Collapse

zabbix is not connecting to database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Naveen
    Junior Member
    • Jun 2020
    • 4

    #1

    zabbix is not connecting to database

    we have installed the zabbix 5.0 and in mysql created the zabbix database as well.

    db is up and able to connect to db/ schema, but after starting zabbix-server in logs could see it is not able to connect to the database. but the database connection details mentioned in zabbix_server.conf correctly. Kindly help

    error :
    connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket
  • Atsushi
    Senior Member
    • Aug 2013
    • 2028

    #2
    What OS and version are you using?
    Are you running the MySQL server on the same server where Zabbix server is running?
    If so, does the socket file /var/lib/mysql/mysql.sock exist?

    If you are using non-standard packages for each distribution on Linux, please tell me how you set up your environment.

    Comment

    • Naveen
      Junior Member
      • Jun 2020
      • 4

      #3
      am using redhat 7.7 os . yes, mysql is running on same server , db socket file ( mysql.sock ) exists in /db/mysql/tmp an no socket file exists in /var/lib/mysql/

      Comment

      • Atsushi
        Senior Member
        • Aug 2013
        • 2028

        #4
        If you have a non-standard package installed and running, please tell me where and how you got it installed and configured. It is necessary to set the database connection information according to the environment.

        Another option might be to create a symbolic link to the socket file.

        Comment

        • Naveen
          Junior Member
          • Jun 2020
          • 4

          #5
          installed the https://repo.zabbix.com/zabbix/5.0/r...el7.noarch.rpm , and the dependent packages (zabbix-get zabbix-agent zabbix-server-mysql zabbix-web-mysql mariadb-server ) using yum .
          In same server i have 2 mysql version both are running on different port. . in /etc/zabbix/zabbix_server.conf i have tried with both the ports

          Tried by creating the softlink for socket file in /var/run/mysqld,but didnt helped. & In ./etc/my.cnf socket files is mentioend as /db/mysql/tmp/mysql.sock
          Last edited by Naveen; 29-06-2020, 09:57.

          Comment

          • Atsushi
            Senior Member
            • Aug 2013
            • 2028

            #6
            The link to create is /var/lib/mysql/mysql.sock.

            Comment

            • Naveen
              Junior Member
              • Jun 2020
              • 4

              #7
              in /var/lib/mysql , created the link as below
              mysql.sock -> /db/mysql-5.7.23/tmp/mysql.sock

              and in /etc/my.cnf it is defined as below

              [mysqld]
              datadir=/var/lib/mysql
              socket=/var/lib/mysql/mysql.sock

              [client]
              socket=/var/lib/mysql/mysql.sock


              after making above changes restarted zabbix , but still seeing same db conenctivity error

              Comment

              Working...