Ad Widget

Collapse

Cannot to database failed

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hexman123
    Junior Member
    • Nov 2015
    • 2

    #1

    Cannot to database failed

    Hi.

    Im trying to set up zabbix and when thorugh the whole process following this guide for debian 8. There about two small typos that I saw while installing and fixed so I dont think they are the cause.
    This tutorial will focus on how to install Zabbix Server on Debian/Ubuntu and RHEL/CentOS/Fedora/RockyLinux/AlmaLinux with MySQL, PHP, and Apache Web Server.


    I got all the way until the very end, but thats where my problem is. When I enter the zabbix page, I get that the zabbix server is not running.
    Code:
    Zabbix server is running	No	localhost:10051
    I used google that lead me to alot of zabbix post to try and fix this error. The closest I got was to see what was causing the error by viewing the zabbix_server.log. This is what I see

    Code:
    565:20151116:104104.827 Starting Zabbix Server. Zabbix 2.4.5 (revision 53282).
       565:20151116:104105.333 ****** Enabled features ******
       565:20151116:104105.333 SNMP monitoring:           YES
       565:20151116:104105.333 IPMI monitoring:            NO
       565:20151116:104105.333 WEB monitoring:            YES
       565:20151116:104105.333 VMware monitoring:         YES
       565:20151116:104105.333 Jabber notifications:       NO
       565:20151116:104105.333 Ez Texting notifications:  YES
       565:20151116:104105.333 ODBC:                       NO
       565:20151116:104105.333 SSH2 support:               NO
       565:20151116:104105.333 IPv6 support:              YES
       565:20151116:104105.333 ******************************
       565:20151116:104105.333 using configuration file: /usr/local/etc/zabbix_server.conf
       565:20151116:104107.780 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
       565:20151116:104107.780 database is down: reconnecting in 10 seconds
       565:20151116:104117.404 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
       565:20151116:104120.960 database is down: reconnecting in 10 seconds
       565:20151116:104130.960 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
       565:20151116:104130.960 database is down: reconnecting in 10 seconds
       565:20151116:104141.075 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: NO)
       565:20151116:104141.075 database is down: reconnecting in 10 seconds
       565:20151116:104151.076 [Z3001] connection to database 'zabbix' failed: [1045]
    It just keeps on repeating the last line. It says somethign about the socket so I dont think its a password error, and I have checked both zabbix_server.conf and zabbix.conf.php so they match.

    This is my zabbix.conf.php (my password IS "your_password" lol)
    PHP Code:
    ?php
    // Zabbix GUI configuration file.
    global $DB;

    $DB['TYPE']     = 'MYSQL';
    $DB['SERVER']   = 'localhost';
    $DB['PORT']     = '0';
    $DB['DATABASE'] = 'zabbix';
    $DB['USER']     = 'zabbix';
    $DB['PASSWORD'] = 'your_password';

    // Schema name. Used for IBM DB2 and PostgreSQL.
    $DB['SCHEMA'] = '';

    $ZBX_SERVER      'localhost';
    $ZBX_SERVER_PORT '10051';
    $ZBX_SERVER_NAME 'zabbix';

    $IMAGE_FORMAT_DEFAULT IMAGE_FORMAT_PNG;
    ?> 
    Few of my zabbix_server.conf
    Code:
    ### Option: DBSocket
    #       Path to MySQL socket.
    #
    # Mandatory: no
    # Default:
    # DBSocket=/var/run/mysqld/mysqld.sock
    
    ### Option: DBPort
    #       Database port when not using local socket. Ignored for SQLite.
    #
    # Mandatory: no
    # Range: 1024-65535
    # Default (for MySQL):
    # DBPort=3306
    The onyl thing I have not tried is the SELinux topic that i have read. Could that help me out or is it unrelated. Need more info?

    PS: I saw a post about sockets but i have to go, ill see if i can find it. It was posted here is zabbix forums
  • Parasin
    Member
    Zabbix Certified Specialist
    • Dec 2014
    • 53

    #2
    Have you verified that your path to the mysqld.sock file is correct?

    Furthermore, are the configurations within that file set correctly?

    Comment

    • aib
      Senior Member
      • Jan 2014
      • 1615

      #3
      Do you mind to UN-comment line
      Code:
      # DBSocket=/var/run/mysqld/mysqld.sock
      and restart zabbix_server again?
      Sincerely yours,
      Aleksey

      Comment

      • hexman123
        Junior Member
        • Nov 2015
        • 2

        #4
        Well, I tried alot of things from reading the forums and different web places. I am learning more as I try new methods to fix the problem. I have tried both suggestions from above and un-commented other possibilities in the zabbix_server.conf . I will keep on trying to fix this and any suggestion would help.

        Question.
        Some people have said that SElinux might be causing the problems. As mentioned I am running Debian 8 and read this bit from the Debian website concerning SElinux

        "CAUTION Reference policy not in jessie

        Unfortunately the maintainers of the refpolicy source package did not handle release critical bugs on their package and the package got removed from jessie. This means that the selinux-policy-* packages are currently not installable in jessie and need to be fetched from another place. Hopefully they will come back in one of the point releases or in jessie-backports. In the meantime, you can grab them from unstable.
        This sad situation at least proves that SELinux is not very popular in the set of users/developers who are running the development versions of Debian. Thus, if you opt to use SELinux, you should expect the default policy to not work perfectly and you will have to invest quite some time to make it suitable to your specific needs."

        I am super new so I don't fully understand. Is it that SElinux IS installed but there is no way to change the the rules, or that SElinux is not working at all?

        Comment

        Working...