Ad Widget

Collapse

Zabbix Cannot connect to the database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • baloc90
    Junior Member
    • Nov 2017
    • 16

    #1

    Zabbix Cannot connect to the database

    please help me this error .I install zabbix 3.0 on CentOS 7.After finish i run and it have problem as attached image.
  • kaspars.mednis
    Senior Member
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Oct 2017
    • 349

    #2
    Hi,

    Sorry, but i cant see any images attached.
    You can attach part of zabbix_server.log file instead, usually problems related to zabbix server start is listed there

    P.S
    If you are doing fresh start, why not to use Zabbix 3.4 ? it has many great new features and improvements over 3.0

    Regards,
    Kaspars

    Comment

    • baloc90
      Junior Member
      • Nov 2017
      • 16

      #3
      Originally posted by kaspars.mednis
      Hi,

      Sorry, but i cant see any images attached.
      You can attach part of zabbix_server.log file instead, usually problems related to zabbix server start is listed there

      P.S
      If you are doing fresh start, why not to use Zabbix 3.4 ? it has many great new features and improvements over 3.0

      Regards,
      Kaspars
      Dear Kaspars.

      Because I just learned linux and tried it for the first time. I followed this video tutorial. Can you give me the reference of installing zabbix 3.4?

      Comment

      • kaspars.mednis
        Senior Member
        Zabbix Certified Trainer
        Zabbix Certified SpecialistZabbix Certified Professional
        • Oct 2017
        • 349

        #4
        Its really simple to install Zabbix 3.4 on centos 7, here is install manual

        https://www.zabbix.com/documentation...es/rhel_centos (Centos is RHEL7 based)

        If you are not familar with Centos 7 and this is your first test system, i suggest you turning off SELINUX and firewalld for testing purposes, you will get a lot of troubles with them

        Feel free to ask questions if something goes wrong

        Regards
        Kaspars

        Comment

        • baloc90
          Junior Member
          • Nov 2017
          • 16

          #5

          Comment

          • kaspars.mednis
            Senior Member
            Zabbix Certified Trainer
            Zabbix Certified SpecialistZabbix Certified Professional
            • Oct 2017
            • 349

            #6
            As this is your first Linux expierence, i will go step by step

            1. Have you installed mysql server (mariadb on Centos 7) ?

            Code:
            yum install mariadb-server
            2. If you have installed it, it must be enabled for autostart and started and

            Code:
            systemctl enable mariadb
            systemctl start maridb
            3. after that you must be able to open mysql console typing a simple command in console mysql, after that type following comands:

            Code:
            mysql> create database zabbix character set utf8 collate utf8_bin;
            mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '<password>';
            mysql> quit;
            replace <password> with password of your choice

            4. in console type the following command to create DB schema (depending on your downloaded zabbix version, zabbix-server-mysql-3.4.4 part may differ a little, be sure you are pointing at the right directory
            Code:
            zcat /usr/share/doc/zabbix-server-mysql-3.4.4/create.sql.gz | mysql zabbix -uzabbix -p
            5. edit /etc/zabbix/zabbix_server.conf , find DBPassword=<password> entry, replace <password > with password you specified when created zabbix user

            6. Enable and start zabbix-server and agent

            Code:
            systemctl enable zabbix-server
            systemctl start zabbix-server
            systemctl enable zabbix-agent
            systemctl start zabbix-agent
            If you have completed all steps above, you must be able to connect to zabbix DB

            Comment

            • baloc90
              Junior Member
              • Nov 2017
              • 16

              #7
              please see the error message below

              Comment

              • baloc90
                Junior Member
                • Nov 2017
                • 16

                #8
                I can login with 2 sql accounts: root and zabbix as below. i do not quite understand the difference of it.

                Comment

                • kaspars.mednis
                  Senior Member
                  Zabbix Certified Trainer
                  Zabbix Certified SpecialistZabbix Certified Professional
                  • Oct 2017
                  • 349

                  #9
                  Two issues here:

                  1. please provide output of the following command:

                  Code:
                  getenforce
                  2. You do not have directory /usr/share/doc/zabbix-server-mysql-3.4.4, neither you have/usr/share/doc/zabbix-server-mysql-3.4

                  please go to /usr/share/doc/ and check the right path

                  Code:
                   cd /usr/share/doc/
                   ls -la | grep zabbix-server-mysql
                  then write the correct path in zcat command. This command must return no errors !!!

                  Comment

                  • baloc90
                    Junior Member
                    • Nov 2017
                    • 16

                    #10
                    Information sent to you

                    Comment

                    • kaspars.mednis
                      Senior Member
                      Zabbix Certified Trainer
                      Zabbix Certified SpecialistZabbix Certified Professional
                      • Oct 2017
                      • 349

                      #11
                      then this command must work...

                      zcat /usr/share/doc/zabbix-server-mysql-3.4.4/create.sql.gz | mysql zabbix -uzabbix -p
                      enter your zabbix db user password when it asks for password

                      Comment

                      • baloc90
                        Junior Member
                        • Nov 2017
                        • 16

                        #12
                        Originally posted by kaspars.mednis
                        then this command must work...



                        enter your zabbix db user password when it asks for password

                        Comment

                        • kaspars.mednis
                          Senior Member
                          Zabbix Certified Trainer
                          Zabbix Certified SpecialistZabbix Certified Professional
                          • Oct 2017
                          • 349

                          #13
                          Try following
                          Code:
                          yum remove zabbix-server-mysql
                          yum clean all
                          yum install zabbix-server-mysql
                          
                          zcat /usr/share/doc/zabbix-server-mysql-3.4.4/create.sql.gz | mysql zabbix -uzabbix -p

                          Comment

                          • baloc90
                            Junior Member
                            • Nov 2017
                            • 16

                            #14
                            Originally posted by kaspars.mednis
                            Try following
                            Code:
                            yum remove zabbix-server-mysql
                            yum clean all
                            yum install zabbix-server-mysql
                            
                            zcat /usr/share/doc/zabbix-server-mysql-3.4.4/create.sql.gz | mysql zabbix -uzabbix -p

                            Comment

                            • kaspars.mednis
                              Senior Member
                              Zabbix Certified Trainer
                              Zabbix Certified SpecialistZabbix Certified Professional
                              • Oct 2017
                              • 349

                              #15
                              Now please edit the /etc/zabbix/zabbix_server.conf, and correct DBPassword=<password>
                              here goes your password from zabbix DB user you created

                              after that
                              Code:
                              systemctl start zabbix-server
                              and please provide th following output after that
                              Code:
                              tail /var/log/zabbix/zabbix_server.log

                              Comment

                              Working...