Ad Widget

Collapse

connection to database 'zabbix' failed

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • marian02008
    Junior Member
    • Nov 2016
    • 2

    #1

    connection to database 'zabbix' failed

    Hi, i just finish the installation of zabbix, log in on the site and saw a message "Zabbix server is not running ....."

    So, i open the log file and get:
    HTML Code:
    Log:  1637:20161116:191741.752 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysql.sock' (2)
      1637:20161116:191741.752 Cannot connect to the database. Exiting...
    I run:
    HTML Code:
    mysql_config --socket
    /var/run/mysqld/mysqld.sock
    my.cnf
    HTML Code:
    port            = 3306
    socket          = /var/run/mysqld/mysqld.sock

    zabbix_server.conf
    HTML Code:
    DBSocket=/run/mysqld/mysql.sock
    DBPort=3306
    i can connect to mysql with the user that was created for zabbix. So i don't know what is wrong?

    i'm newby on this, thanks for help me.

    Mariano
  • kloczek
    Senior Member
    • Jun 2006
    • 1771

    #2
    Put in DBHost=localhost. MySQL client library automatically converts connecting over localhost to use unix sockets.
    http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
    https://kloczek.wordpress.com/
    zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
    My zabbix templates https://github.com/kloczek/zabbix-templates

    Comment

    • marian02008
      Junior Member
      • Nov 2016
      • 2

      #3
      HI kloczek, i forgot mention that i'm using mariadb, debian 8 and zabbix 3.2.1

      This is my zabbix_server.conf
      HTML Code:
      ListenPort=10051
      DBHost=localhost
      DBName=zabbix
      DBUser=zabbix
      DBPassword=<password>
      DBSocket=/run/mysqld/mysql.sock
      DBPort=3306
      My my.cnf
      HTML Code:
      [client]
      port            = 3306
      socket          = /var/run/mysqld/mysqld.sock
      [mysqld_safe]
      socket          = /var/run/mysqld/mysqld.sock
      nice            = 0
      # * Basic Settings
      #
      user            = mysql
      pid-file        = /var/run/mysqld/mysqld.pid
      socket          = /var/run/mysqld/mysqld.sock
      port            = 3306
      basedir         = /usr
      datadir         = /var/lib/mysql
      tmpdir          = /tmp
      lc-messages-dir = /usr/share/mysql
      skip-external-locking
      #
      
      log_error = /var/log/mysql/error.log
      Site:
      Parameter Value Details
      Zabbix server is running No localhost:10051

      thanks

      Comment

      • WillemR
        Member
        • Oct 2015
        • 30

        #4
        what happens if you fill in a path in the dbname

        for example: /tmp/zabbix.db ?

        did you check the /var/log/messages log ?

        Can you bring everything down from mariadb/zabbix and check if there are other programs listening on the same ports of zabbix/mariadb ?

        if i'm not mistaken you can check the ports part with "natstat -ano"

        Kind Regards,

        Comment

        Working...