Ad Widget

Collapse

HELP: Can not get into frontend

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gedp
    Member
    • May 2006
    • 47

    #1

    HELP: Can not get into frontend

    Finally was able to install the 1.4.1, but when trying to login into the frontend, the following error pops up and I found no way to get around this:

    * Error in query [select u.* from users u where u.alias='guest' and (u.userid div 100000000000000)=0] [You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'div 100000000000000)=0' at line 1]
    * mysql_fetch_array(): supplied argument is not a valid MySQL result resource[/srv/www/htdocs/zabbix/include/db.inc.php:411]
    * Error in query [select u.userid,u.alias,u.name,u.surname,u.url,u.refresh from users u where u.alias='Admin' and u.passwd='a559c567f254cd3792353d8a5fd1f019' and (u.userid div 100000000000000)=0] [You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'div 100000000000000)=0' at line 1]
    * mysql_fetch_array(): supplied argument is not a valid MySQL result resource[/srv/www/htdocs/zabbix/include/db.inc.php:411]
    * Error in query [insert into auditlog (auditid,userid,clock,action,resourcetype,details) values (3,0,1184673312,3,0,'Login failed [Admin]')] [Duplicate entry '3' for key 1]

    A select from the users table:

    mysql> select * from users;
    +--------+----------+-----------+---------------+----------------------------------+--------------------------------------------------+------------+-------+---------+------+
    | userid | alias | name | surname | passwd | url | autologout | lang | refresh | type |
    +--------+----------+-----------+---------------+----------------------------------+--------------------------------------------------+------------+-------+---------+------+
    | 1 | Admin | Zabbix | Administrator | a559c567f254cd3792353d8a5fd1f019 | | 900 | en_gb | 30 | 3 |
    | 2 | guest | Default | User | d41d8cd98f00b204e9800998ecf8427e | | 900 | en_gb | 30 | 1 |
    | 3 | helpdesk | XXXXXX | helpdesk | eb4985990d10e3e2f5e3f30359ed0ccb | screens.php | 3600 | en_gb | 60 | 1 |
    | 4 | XXXX | XXXXXXXXX | XXXXX | 051f74dbdc2db120b197dff11d1b682d | | 900 | en_gb | 30 | 1 |
    | 5 | it | XXXXXX | it | 0d149b90e7394297301c90191ae775f0 | tr_status.php | 900 | en_gb | 30 | 1 |
    | 6 | readonly | readonly | readonly | b3e3f521afc37ca6622964da4466b07c | http://XXXXXXXXXXXXXXXXXXXX/zabbix/tr_status.php | 900 | en_gb | 30 | 1 |
    +--------+----------+-----------+---------------+----------------------------------+--------------------------------------------------+------------+-------+---------+------+
    6 rows in set (0.00 sec)

    (put some XX instead of names)

    Please help. I'm stuck without monitoring at this stage.
  • gedp
    Member
    • May 2006
    • 47

    #2
    Seems syntax is not knows by mysql:

    mysql> select u.* from users u where u.alias='guest';
    +--------+-------+---------+---------+----------------------------------+-----+------------+-------+---------+------+
    | userid | alias | name | surname | passwd | url | autologout | lang | refresh | type |
    +--------+-------+---------+---------+----------------------------------+-----+------------+-------+---------+------+
    | 2 | guest | Default | User | d41d8cd98f00b204e9800998ecf8427e | | 900 | en_gb | 30 | 1 |
    +--------+-------+---------+---------+----------------------------------+-----+------------+-------+---------+------+
    1 row in set (0.00 sec)

    mysql> select u.* from users u where u.alias='guest' and (u.userid div 100000000000000)=0
    -> ;
    ERROR 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'div 100000000000000)=0' at line 1

    Used version is:
    mysql Ver 12.22 Distrib 4.0.18, for suse-linux (i686)

    Comment

    • gedp
      Member
      • May 2006
      • 47

      #3
      Seems the mysql operator 'div' is only recognized from 4.1.0 onwards. Manual states 3.22 is ok.

      Comment

      • gedp
        Member
        • May 2006
        • 47

        #4
        This seems to do the trick in db.inc.php. I don't know if there would be any possible sideeffects. Can somebody check this?

        function DBid2nodeid($id_name)
        {
        global $DB_TYPE;

        switch($DB_TYPE)
        {
        case "MYSQL":
        #$result = '('.$id_name.' div 100000000000000)';
        $result = '('.$id_name.')';
        $result = bcdiv($result, '100000000000000');
        break;
        case "ORACLE":
        $result = 'round('.$id_name.'/100000000000000)';
        break;
        default:
        $result = '('.$id_name.'/100000000000000)';
        }
        return $result;
        }

        Comment

        • ReefShark
          Member
          • Dec 2005
          • 43

          #5
          *BUMP*

          I had to use this 'patch' because I had the same problem (SLES9 server, old MySQL version). Hope this somehow gets solved in future versions, perhaps a check for old MySQL installs and automatically using a working syntax when bumping into one?

          Comment

          Working...