Ad Widget

Collapse

Mysql database patch problems with 1.8

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • icica
    Junior Member
    • Oct 2008
    • 19

    #1

    Mysql database patch problems with 1.8

    Hello everyone
    I tried to use the script to update the mysql database from version 1.6 to 1.8 and I get an error when creating the database expressions

    ERROR 1064 (42000) at line 49: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use.

    MySql version is 5.0.75-0ubuntu10


    Someone knows it can be happening?

    Thanks.
  • richlv
    Senior Member
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Oct 2005
    • 3112

    #2
    yes, there's already an issue submitted at https://support.zabbix.com/browse/ZBX-1471
    maybe mysql 5.0 specific reserved function name ? works flawlessly on mysql 5.1
    Zabbix 3.0 Network Monitoring book

    Comment

    • low10sws6
      Member
      • Oct 2008
      • 44

      #3
      Fixed

      I Fixed this problem replacing the original create table 'expressions' in the patch.sql file with the following bellow

      Code:
      CREATE TABLE `expressions` (
             `expressionid`            BIGINT UNSIGNED         DEFAULT '0'     NOT NULL,
             `regexpid`                BIGINT UNSIGNED         DEFAULT '0'     NOT NULL,
             `expression`              VARCHAR(255)            DEFAULT ''      NOT NULL,
             `expression_type`         INTEGER         DEFAULT '0'     NOT NULL,
             `exp_delimiter`           VARCHAR(1)              DEFAULT ''      NOT NULL,
             `case_sensitive`          INTEGER         DEFAULT '0'     NOT NULL,
             PRIMARY KEY (`expressionid`)
      ) type=INNODB;
      i'm running
      Mysql and OS 8.4
      5.0.75-0ubuntu10.2

      Comment

      • richlv
        Senior Member
        Zabbix Certified Trainer
        Zabbix Certified SpecialistZabbix Certified Professional
        • Oct 2005
        • 3112

        #4
        well, that's not an entirely valid long term fix - could anybody try this quoting table name and fields one by one to see which one is reserved ?
        Zabbix 3.0 Network Monitoring book

        Comment

        • icica
          Junior Member
          • Oct 2008
          • 19

          #5
          Hello
          I have been tested and the problem is in the field "case_sensitive". I've solved as low10sws6 says.

          I have also seen that there are problems with the next statement.
          alter table graphs_items color change color varchar (6) DEFAULT '009600 'NOT NULL;
          (line 66 approximately)

          I've replaced by
          alter table `color` graphs_items `modify` varchar (6) DEFAULT '009600 'NOT NULL;

          Comment

          • stemasie
            Junior Member
            • Sep 2009
            • 18

            #6
            Hi all,

            i posted this bug here: https://support.zabbix.com/browse/ZBX-1471 .
            I fixed it the same way the user low10sws6 did that time, it works perfectly with MySQL 5.4 BETA.
            It took about 4 hours and many many database restores to find that bug-_-

            Comment

            • laakness
              Junior Member
              • Oct 2009
              • 20

              #7
              So will this fix cause issues in the future? I can't imagine it really would but just wanted to verify.

              Edit: Nevermind, I see that there are no changes to the actual data, just the quoting of column names.
              Last edited by laakness; 11-12-2009, 17:50.

              Comment

              • Justin Freeman
                Junior Member
                • Jan 2009
                • 18

                #8
                Same MySQL errors on upgrade from 1.6 to 1.8.2

                Same MySQL errors on upgrade from 1.6 to 1.8.2.

                It is beyond my understanding why 1.8.2 has not been updated with the correct SQL commands. It would certainly save a lot of grief to sys. admins.

                It's also worth noting that if you do hit up against this problem, you can simply fix the offending SQL statements, remove all prior SQL statements (since they will have executed) and then apply the patch.sql again. This should be OK and save you having to restore and import from backup.

                The following changes worked for me.

                From low10sws6 post above:
                Code:
                CREATE TABLE `expressions` (
                       `expressionid`            BIGINT UNSIGNED         DEFAULT '0'     NOT NULL,
                       `regexpid`                BIGINT UNSIGNED         DEFAULT '0'     NOT NULL,
                       `expression`              VARCHAR(255)            DEFAULT ''      NOT NULL,
                       `expression_type`         INTEGER         DEFAULT '0'     NOT NULL,
                       `exp_delimiter`           VARCHAR(1)              DEFAULT ''      NOT NULL,
                       `case_sensitive`          INTEGER         DEFAULT '0'     NOT NULL,
                       PRIMARY KEY (`expressionid`)
                ) type=INNODB;
                From https://support.zabbix.com/browse/ZBX-1471
                Code:
                alter table graphs_items change color color varchar(6) DEFAULT '009600' NOT
                Last edited by Justin Freeman; 10-06-2010, 03:44.

                Comment

                • richlv
                  Senior Member
                  Zabbix Certified Trainer
                  Zabbix Certified SpecialistZabbix Certified Professional
                  • Oct 2005
                  • 3112

                  #9
                  Originally posted by Justin Freeman
                  It is beyond my understanding why 1.8.2 has not been updated with the correct SQL commands.
                  it would be appreciated if somebody could point at mysql documentation for specific versions that shows some reserved words that are unquoted in zabbix database file.
                  Zabbix 3.0 Network Monitoring book

                  Comment

                  • Palmertree
                    Senior Member
                    • Sep 2005
                    • 746

                    #10
                    2.2. Reserved Words in MySQL 5.1 (http://dev.mysql.com/doc/mysqld-vers...words-5-1.html)

                    The following table shows the reserved words in MySQL 5.1.
                    ACCESSIBLE[a] ADD ALL ALTER ANALYZE AND AS ASC ASENSITIVE BEFORE BETWEEN BIGINT BINARY BLOB BOTH BY CALL CASCADE CASE CHANGE CHAR CHARACTER CHECK COLLATE COLUMN CONDITION CONNECTION[b] CONSTRAINT CONTINUE CONVERT CREATE CROSS CURRENT_DATE CURRENT_TIME CURRENT_TIMESTAMP CURRENT_USER CURSOR DATABASE DATABASES DAY_HOUR DAY_MICROSECOND DAY_MINUTE DAY_SECOND DEC DECIMAL DECLARE DEFAULT DELAYED DELETE DESC DESCRIBE DETERMINISTIC DISTINCT DISTINCTROW DIV DOUBLE DROP DUAL EACH ELSE ELSEIF ENCLOSED ESCAPED EXISTS EXIT EXPLAIN FALSE FETCH FLOAT FLOAT4 FLOAT8 FOR FORCE FOREIGN FROM FULLTEXT GOTO[c] GRANT GROUP HAVING HIGH_PRIORITY HOUR_MICROSECOND HOUR_MINUTE HOUR_SECOND IF IGNORE IN INDEX INFILE INNER INOUT INSENSITIVE INSERT INT INT1 INT2 INT3 INT4 INT8 INTEGER INTERVAL INTO IS ITERATE JOIN KEY KEYS KILL LABEL[d] LEADING LEAVE LEFT LIKE LIMIT LINEAR LINES LOAD LOCALTIME LOCALTIMESTAMP LOCK LONG LONGBLOB LONGTEXT LOOP LOW_PRIORITY MASTER_SSL_VERIFY_SERVER_CERT[e] MATCH MEDIUMBLOB MEDIUMINT MEDIUMTEXT MIDDLEINT MINUTE_MICROSECOND MINUTE_SECOND MOD MODIFIES NATURAL NOT NO_WRITE_TO_BINLOG NULL NUMERIC ON OPTIMIZE OPTION OPTIONALLY OR ORDER OUT OUTER OUTFILE PRECISION PRIMARY PROCEDURE PURGE RANGE READ READS READ_ONLY[f] READ_WRITE[g] REAL REFERENCES REGEXP RELEASE RENAME REPEAT REPLACE REQUIRE RESTRICT RETURN REVOKE RIGHT RLIKE SCHEMA SCHEMAS SECOND_MICROSECOND SELECT SENSITIVE SEPARATOR SET SHOW SMALLINT SPATIAL SPECIFIC SQL SQLEXCEPTION SQLSTATE SQLWARNING SQL_BIG_RESULT SQL_CALC_FOUND_ROWS SQL_SMALL_RESULT SSL STARTING STRAIGHT_JOIN TABLE TERMINATED THEN TINYBLOB TINYINT TINYTEXT TO TRAILING TRIGGER TRUE UNDO UNION UNIQUE UNLOCK UNSIGNED UPDATE UPGRADE[h] USAGE USE USING UTC_DATE UTC_TIME UTC_TIMESTAMP VALUES VARBINARY VARCHAR VARCHARACTER VARYING WHEN WHERE WHILE WITH WRITE XOR YEAR_MONTH ZEROFILL [a] ACCESSIBLE not reserved in: 5.1.3-5.1.5

                    [b] CONNECTION not reserved in: 5.1.47, 5.1.16-5.1.47

                    [c] GOTO not reserved in: 5.1.47, 5.1.11-5.1.47

                    [d] LABEL not reserved in: 5.1.47, 5.1.11-5.1.47

                    [e] MASTER_SSL_VERIFY_SERVER_CERT not reserved in: 5.1.3-5.1.17

                    [f] READ_ONLY not reserved in: 5.1.3-5.1.5, 5.1.24-5.1.47

                    [g] READ_WRITE not reserved in: 5.1.3-5.1.5

                    [h] UPGRADE not reserved in: 5.1.3-5.1.6, 5.1.12-5.1.47


                    The following are new reserved words in MySQL 5.1:
                    ACCESSIBLE LINEAR MASTER_SSL_VERIFY_SERVER_CERT RANGE READ_ONLY READ_WRITE

                    Comment

                    • richlv
                      Senior Member
                      Zabbix Certified Trainer
                      Zabbix Certified SpecialistZabbix Certified Professional
                      • Oct 2005
                      • 3112

                      #11
                      i'm probably too daft, but which of the listed reserved words is used in that table definition ?
                      Zabbix 3.0 Network Monitoring book

                      Comment

                      Working...