Ad Widget

Collapse

How to upgrade existing DB? The Zabbix database version does not match

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Maxburn
    Member
    • Sep 2019
    • 48

    #1

    How to upgrade existing DB? The Zabbix database version does not match

    I'm upgrading LTS Zabbix 5.0.20 to LTS 6.0.1 on a new server. Installed the LAMP stack, then dumped the DB on the old server and imported it on the new server. Installed Zabbix and in the web page setup I'm looking at this error. Is there a particular reason it won't upgrade what I already have? I think this is the same procedure I remember doing in 4->5 upgrade? I'm not seeing anything obvious to me in the upgrade notes.


    The Zabbix database version does not match current requirements. Your database version: 5050134. Required version: 6000000. Please contact your system administrator.
    Click image for larger version

Name:	zabbixversionupgrade.png
Views:	31551
Size:	36.8 KB
ID:	440741
  • derli1988
    Member
    • Apr 2021
    • 60

    #2
    When you upgrade the zabbix server or proxy, the Database gets upgraded automatically.

    You may wanna look at the logs under /var/logs/zabbix/zabbix_server.log and grep it by database... You may see a porcentage.

    Run this:

    cat /var/log/zabbix/zabbix_server.log | grep database

    Comment

    • Maxburn
      Member
      • Sep 2019
      • 48

      #3
      Oh, yes I see what you mean. I guess I just didn't wait long enough and the upgrade happened in the background?

      I wonder if I should be concerned about primary keys or double precision?

      Click image for larger version

Name:	zabbixversionupgrade2.png
Views:	31550
Size:	50.8 KB
ID:	440769

      Comment

      • derli1988
        Member
        • Apr 2021
        • 60

        #4
        It happens.... First time I upgraded zabbix I also faced that issue and I was also impatient.

        But you're on the right path.... Now, I wouldn't be worried about primary keys and double precision values.

        It's also always a good idea to backup your config files and dump your database on a regular basis.


        I have this if it helps:


        Code:
        #!/bin/bash
        #!/usr/bin
        
        echo "defining variables"
        USER="sysops"
        PASS="xxxxxxx"
        YEAR=$(date +%Y)
        MONTH=$(date +%m)
        DAY=$(date +%d)
        OLDDATE=$(date +%F --date="1 week ago")
        DIR=/opt/backup/zabbix
        mkdir -p /opt/backup/zabbix
        
        echo "Creating the backup files"
        cd $DIR
        mysqldump --user=$USER --password=$PASS --lock-tables=false zabbix -C -q > $DIR/zabbix_server-$(date +%F).sql
        
        ST=$?
        
        #echo "creating the folder hierarchy"
        #if [ -d "$DIR/$YEAR" ]
        #then
        # echo "Directory $DIR/$YEAR exists."
        #else
        # echo "Directory $DIR/$YEAR does not exist, creating it."
        # mkdir $DIR/$YEAR
        #fi
        #
        #if [ -d "$DIR/$YEAR/$MONTH" ]
        #then
        # echo "Directory $DIR/$YEAR/$MONTH exists."
        #else
        # echo "Directory $DIR/$YEAR/$MONTH does not exist, creating it."
        # mkdir $DIR/$YEAR/$MONTH
        #fi
        #
        #if [ -d "$DIR/$YEAR/$MONTH/$DAY" ]
        #then
        # echo "Directory $DIR/$YEAR/$MONTH/$DAY exists."
        #else
        # echo "Directory $DIR/$YEAR/$MONTH/$DAY does not exist, creating it."
        # mkdir $DIR/$YEAR/$MONTH/$DAY
        #fi
        
        
        # if the database dump worked
        if [ $ST -eq 0 ]
        then
        echo "copying Zabbix binary, doc and conf files"
        cp -p /opt/script/mysqldump.sh $DIR/
        cp -p /etc/zabbix/zabbix_server.conf $DIR/
        cp -p /etc/zabbix/zabbix_agentd.conf $DIR/
        cp -rp /usr/sbin/zabbix_server $DIR/
        cp -rp /usr/share/doc/zabbix-* $DIR/
        cp -p /etc/apache2/conf-enabled/zabbix.conf $DIR/
        cp -rp /usr/share/zabbix/ $DIR/
        
        # Creating the archive
        zip -r -9 zabbix_server-$(date +%F).zip *
        
        ST=$?
        
        # Moving the backup to S3 bucket
        aws s3 mv zabbix_server-$(date +%F).zip s3://ra-zabbix-backup/Zabbix_Server/
        
        # if the backup was successful
        if [ $ST -eq 0 ]
        then
        echo "deleting sql database files and zabbix conf files"
        rm -f zabbix_server-$(date +%F).sql zabbix*.conf
        rm -rf $DIR/
        aws s3 rm s3://ra-zabbix-backup/Zabbix_Server/zabbix_server-$OLDDATE.zip
        fi
        fi
        I've omitted the database root password, after I compact everything, I send it all to an S3 bucket.

        Comment

        • marianogedisman
          Member
          • Oct 2021
          • 78

          #5
          Hello everyone! I'm experiencing the same error, however I am running Zabbix from a Docker image (docker-compose), how can I fix this? I have no access to any server logs because the server quits with exit code 1 due to this issue.

          Comment


          • ahilles13
            ahilles13 commented
            Editing a comment
            happened?
            thx
        • Maxburn
          Member
          • Sep 2019
          • 48

          #6
          My answer was to just wait until the upgrade is done.

          Comment

          • marianogedisman
            Member
            • Oct 2021
            • 78

            #7
            Originally posted by Maxburn
            My answer was to just wait until the upgrade is done.
            Hello Max! But what if the upgrade never happens? Also, does it apply to Docker images? Because I'm not running anything, just spinning up a Docker compose job and that's it.

            Comment

            • OndZaj
              Junior Member
              • Oct 2022
              • 3

              #8
              Hello, I am having the same issues, but it seems like the database isn't being updated. When I do "cat /var/log/zabbix/zabbix_server.log | grep database" I get this.

              Please help. I couldn't find anything. Thank you very much!Click image for larger version

Name:	2022-10-11_14-10-56.png
Views:	24565
Size:	1.27 MB
ID:	452540

              Comment


              • Atsushi
                Atsushi commented
                Editing a comment
                It doesn't make sense to just look at the line with the string database. There should be some reason why the version cannot be upgraded in the log, so please check the log properly.
            • ckdmr
              Junior Member
              • Oct 2022
              • 2

              #9
              Hi All,
              I have the same output when trying to install Zabbix to VM Ubuntu 22.04

              I see in the logs it says the server is down and could not connect via Zabbix user but I am able to log in to the MySQL server

              any idea would be appreciated. Thanks

              root@can-linux:/# service mysql status
              ● mysql.service - MySQL Community Server
              Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
              Active: active (running) since Wed 2022-10-26 15:31:43 CEST; 9min ago
              Process: 186938 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
              Main PID: 186946 (mysqld)
              Status: "Server is operational"
              Tasks: 39 (limit: 2288)
              Memory: 410.4M
              CPU: 6.641s
              CGroup: /system.slice/mysql.service
              └─186946 /usr/sbin/mysqld

              Okt 26 15:31:39 can-linux systemd[1]: Starting MySQL Community Server...
              Okt 26 15:31:43 can-linux systemd[1]: Started MySQL Community Server.
              root@can-linux:/# tail /var/log/zabbix/zabbix_server.log|grep database
              183999:20221026:154044.516 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: YES)
              183999:20221026:154044.516 database is down: reconnecting in 10 seconds
              183999:20221026:154054.524 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: YES)
              183999:20221026:154054.524 database is down: reconnecting in 10 seconds
              183999:20221026:154104.528 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: YES)
              183999:20221026:154104.528 database is down: reconnecting in 10 seconds
              183999:20221026:154114.532 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: YES)
              183999:20221026:154114.532 database is down: reconnecting in 10 seconds
              183999:20221026:154124.536 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: YES)
              183999:20221026:154124.536 database is down: reconnecting in 10 seconds
              root@can-linux:/#
              root@can-linux:/#
              root@can-linux:/#
              root@can-linux:/#
              root@can-linux:/# mysql -u zabbix -p
              Enter password:
              Welcome to the MySQL monitor. Commands end with ; or \g.
              Your MySQL connection id is 74
              Server version: 8.0.31-0ubuntu0.22.04.1 (Ubuntu)

              Copyright (c) 2000, 2022, Oracle and/or its affiliates.

              Oracle is a registered trademark of Oracle Corporation and/or its
              affiliates. Other names may be trademarks of their respective
              owners.

              Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

              mysql>





              Click image for larger version

Name:	image.png
Views:	24274
Size:	470.7 KB
ID:	453366
              ​​
              Attached Files

              Comment

              • cyber
                Senior Member
                Zabbix Certified SpecialistZabbix Certified Professional
                • Dec 2006
                • 4807

                #10
                It says it cannot connect to DB called zabbix. it is not exactly same, when you just login to mysql without choosing any db...
                Have you created DB, granted access to user?

                Comment

                • ckdmr
                  Junior Member
                  • Oct 2022
                  • 2

                  #11
                  Hi Cyber,
                  Many thanks for your reply. yes, I figured out it is not the same issue after posting. I am new to this stuff. sorry for that.

                  here the output for access 'zabbix' user i guess?


                  ​​
                  Attached Files

                  Comment

                  • Nuno
                    Junior Member
                    • Sep 2023
                    • 1

                    #12
                    Hello Guys I had the same problem with databases connectivity:


                    Details Cannot connect to the database.

                    The Zabbix database version does not match current requirements.
                    Your database version: 6010048. Required version: 6040000. Please contact your system administrator.



                    RESULUTION:

                    I only used the cat command:

                    cat /var/log/zabbix/zabbix_server.log | grep database

                    Click image for larger version

Name:	image.png
Views:	14802
Size:	244.3 KB
ID:	470775
                    And then:

                    apt upgrade

                    apt update


                    RESULTS:


                    Click image for larger version

Name:	image.png
Views:	14822
Size:	55.2 KB
ID:	470776

                    Thank you.

                    Comment

                    • dineshmadhu
                      Junior Member
                      • May 2024
                      • 3

                      #13
                      I am stuck with a similar issue. I am trying to migrate the Zabbix server with the latest MySQL and Ubuntu, versions. I am stuck in the upgrade process with the below error. I am missing a clear step-by-step process for migrating the Zabbix server. Can someone help me how to fix this issue?

                      At least a doc/video with a clear process of migrating Zabbix server will help me here.
                      Click image for larger version

Name:	image.png
Views:	10113
Size:	42.4 KB
ID:	484216
                      Click image for larger version

Name:	image.png
Views:	10097
Size:	101.8 KB
ID:	484217

                      Comment

                      • mbw
                        Junior Member
                        • Oct 2022
                        • 4

                        #14
                        I strongly suggest you run and look at, perhaps even post a:

                        apt-show-versions | grep zabbix

                        (install apt-show-versions if you dont already have it)

                        I had an issue with following the zabbix server install guide where it wound up with a mix of zabbix5 and zabbix 6 packages.
                        I had to manually install them after determining that installing the zabbix-release ubuntu 22.04 package did not result in me getting the right versions of everything

                        This error can also apparently happen when you have, say, the .deb packages for zabbix server 6.x but deb packages for the zabbix php frontend of some other different major version, like 4.x

                        Comment

                        • dineshmadhu
                          Junior Member
                          • May 2024
                          • 3

                          #15
                          Checked the version, and all looks good.
                          Click image for larger version

Name:	image.png
Views:	10034
Size:	31.6 KB
ID:	484343

                          Does anyone has a manual on how to migrate zabbix 4 to zabbix 6.4 with OS upgrade from ubuntu 16 to Ubuntu 22.04

                          Comment

                          Working...