Ad Widget

Collapse

Zabbix installation: Cannot connect to the database. Database type is empty

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Vigilante12
    Junior Member
    • Aug 2022
    • 6

    #1

    Zabbix installation: Cannot connect to the database. Database type is empty

    I tried to install zabbix-server-mysql 5.0.19 on a VM (newly installed Centos7.5 (centos 1804)).

    My steps are:
    1. Install MySQL 5.7(mysql-community-server), created zabbix database schema, zabbix user, granted full access to zabbix database schema.
    2. Yum installed zabbix-server-mysql zabbix-web-mysql-scl zabbix-apache-conf-scl successfully.
    3. Initialized zabbix database zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
    4. Modified zabbix_server.conf (simply changed DBPassword to the password I previously set for zabbix user)
    5. systemctl restart zabbix-server httpd rh-php72-php-fpm && systemctl enable zabbix-server httpd rh-php72-php-fpm

    Then I go to http://IP/zabbix to complete Zabbix installation.
    All the prerequisites are "OK". But when I go to "Configure DB connection" page, I got an "cannot connect to the database" error.
    And the "Database type" row is empty (normally there would be a scroll down list with options , like the first picture I attach.)
    Please refer to the 2nd picture I attached for the error.

    Things I've tried/checked
    I tried to change Database host to 127.0.0.1 or the IP I configured for the VM; I tried change database port from 0 (which means default port) to 3306 (which is Mysql server default port); Tried use root user to connect instead of zabbix user.
    I am pretty sure database was connectable. (I tried via CLI : mysql -uzabbix - ppassword and connected to the database successfully.)

    I am sure, 10051(zabbix-server) 3306(mysql) 80(apache httpd) ports are available (checked with netstat command)。

    I also tried manually copying a zabbix.conf.php file to /etc/zabbix/web/zabbix.conf.php
    Now when I tried http://IP/zabbix, I was already logged in the frontend page. But......It's basically empty, none of the buttons were responsive when i hit them.

    I doubt the problem is with Apache httpd, there could be some php file missing or maybe there is a lack of some library when apache tring to connect to the database?
    Is there someone who can help me on this? Much appreciated in advance!


    Attached Files
  • Hamardaban
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • May 2019
    • 2713

    #2
    Most likely php packages working with mysql database are not installed in the system

    Comment

    • tim.mooney
      Senior Member
      • Dec 2012
      • 1427

      #3
      Originally posted by Vigilante12
      I tried to install zabbix-server-mysql 5.0.19 on a VM (newly installed Centos7.5 (centos 1804)).

      5. systemctl restart zabbix-server httpd rh-php72-php-fpm && systemctl enable zabbix-server httpd rh-php72-php-fpm
      I'm pretty sure Hamardaban is correct, you're likely missing some PHP extensions.

      The "check pre-requisites" is pretty good, and it has gotten better in recent versions, but there are so many possible install variants that I think it still misses stuff sometimes. Particularly for RHEL 7 / CentOS 7, where some packages may come from SCL, it may not be perfect.

      I recommend you check to see that all of these SCL PHP extensions are installed, in addition to the ones you already have:

      Code:
                  rh-php72-php-gd
                  rh-php72-php-bcmath
                  rh-php72-php-json
                  rh-php72-php-mysqlnd
      If you use LDAP or AD authentication, you may also need 'rh-php72-php-ldap'.

      Note that after installing any of these that are missing, you need to restart rh-php72-php-fpm.

      Comment

      • Vigilante12
        Junior Member
        • Aug 2022
        • 6

        #4
        Originally posted by tim.mooney

        I'm pretty sure Hamardaban is correct, you're likely missing some PHP extensions.

        The "check pre-requisites" is pretty good, and it has gotten better in recent versions, but there are so many possible install variants that I think it still misses stuff sometimes. Particularly for RHEL 7 / CentOS 7, where some packages may come from SCL, it may not be perfect.

        I recommend you check to see that all of these SCL PHP extensions are installed, in addition to the ones you already have:

        Code:
        rh-php72-php-gd
        rh-php72-php-bcmath
        rh-php72-php-json
        rh-php72-php-mysqlnd
        If you use LDAP or AD authentication, you may also need 'rh-php72-php-ldap'.

        Note that after installing any of these that are missing, you need to restart rh-php72-php-fpm.
        Thank you for your advise! Since the zabbix was installed for a client (40km away from my place), I'll have to ask them to help check if these php packages you mentioned are installed (which could take some time coz they told me they were not gonna be in the office for a couple of days).
        But I worry this is not the problem. The below are php pkgs installed on my own virtual machine where I proceeded with exactly the same steps I mentioned in my post.

        Code:
        [root@IOMP-Demo ~]# rpm -qa | grep rh-php72-php*
        rh-php72-php-zip-7.2.24-1.el7.x86_64
        rh-php72-php-pdo-7.2.24-1.el7.x86_64
        rh-php72-php-pear-1.10.5-1.el7.noarch
        rh-php72-php-mbstring-7.2.24-1.el7.x86_64
        rh-php72-php-json-7.2.24-1.el7.x86_64
        rh-php72-php-common-7.2.24-1.el7.x86_64
        rh-php72-php-cli-7.2.24-1.el7.x86_64
        rh-php72-php-mysqlnd-7.2.24-1.el7.x86_64
        rh-php72-php-process-7.2.24-1.el7.x86_64
        rh-php72-php-ldap-7.2.24-1.el7.x86_64
        rh-php72-php-gd-7.2.24-1.el7.x86_64
        rh-php72-php-xml-7.2.24-1.el7.x86_64
        rh-php72-php-bcmath-7.2.24-1.el7.x86_64
        rh-php72-php-fpm-7.2.24-1.el7.x86_64
        Click image for larger version

Name:	image.png
Views:	1344
Size:	185.2 KB
ID:	449612

        I'll upload more information:

        1. My CentOS version:

        Click image for larger version

Name:	centos_version.png
Views:	1407
Size:	163.5 KB
ID:	449613

        2. When I check zabbix-server status



        3. httpd error_log


        Attached Files

        Comment

        • Vigilante12
          Junior Member
          • Aug 2022
          • 6

          #5
          Originally posted by tim.mooney

          I'm pretty sure Hamardaban is correct, you're likely missing some PHP extensions.

          The "check pre-requisites" is pretty good, and it has gotten better in recent versions, but there are so many possible install variants that I think it still misses stuff sometimes. Particularly for RHEL 7 / CentOS 7, where some packages may come from SCL, it may not be perfect.

          I recommend you check to see that all of these SCL PHP extensions are installed, in addition to the ones you already have:

          Code:
          rh-php72-php-gd
          rh-php72-php-bcmath
          rh-php72-php-json
          rh-php72-php-mysqlnd
          If you use LDAP or AD authentication, you may also need 'rh-php72-php-ldap'.

          Note that after installing any of these that are missing, you need to restart rh-php72-php-fpm.
          One more important difference is : Usually, my centos7 virtual machines were created on VMware Exsi platform and zabbix5 works perfectly normal. The issue occured on VMs created on hyper-V platform.

          Comment

          • Gutsycat
            Member
            • Nov 2017
            • 72

            #6
            Originally posted by Vigilante12
            I tried to install zabbix-server-mysql 5.0.19 on a VM (newly installed Centos7.5 (centos 1804)).
            Also keep in mind that 5.0.x is the last Zabbix version you could install on CentOS 7.x

            Comment

            Working...