Ad Widget

Collapse

"Error connecting to database." no option for mysql

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • prisoner267
    Junior Member
    • Jul 2022
    • 2

    #1

    "Error connecting to database." no option for mysql

    i install by following https://www.zabbix.com/download?zabb...debian&os_vers ion=11_bullseye&db=mysql&ws=apache. Completed every task without any error. In the installing page I get the following error "Error connecting to database." I notice that the database is selected as postgres which I cant change I also tried changing the port number to MySQL 3306 still get the same error. "379632:20220731:014649.082 cannot use database "zabbix": its "users" table is empty (is this the Zabbix proxy database?)" this is my log output. Running MySQL script once again I get "ERROR 1050 (42S01) at line 1: Table 'role' already exists"
  • vladimir_lv
    Senior Member
    • May 2022
    • 240

    #2
    First of all, check which Zabbix version you had installed. For MySQL or PostgreSQL?
    Code:
    apt list --installed | grep zabbix

    Can you connect to MySQL using your us and password:
    Code:
    mysql -uzabbix -p zabbix

    Comment


    • prisoner267
      prisoner267 commented
      Editing a comment
      apt list --installed | grep zabbix

      OUTPUT:
      zabbix-agent/parrot,now 1:5.0.8+dfsg-1 amd64 [installed]
      zabbix-apache-conf/unknown,now 1:6.2.1-1+debian11 all [installed]
      zabbix-frontend-php/parrot,parrot,now 1:5.0.8+dfsg-1 all [installed]
      zabbix-release/unknown,now 1:6.2-1+debian11 all [installed]
      zabbix-server-mysql/parrot,now 1:5.0.8+dfsg-1 amd64 [installed]
      zabbix-sql-scripts/unknown,now 1:6.2.1-1+debian11 all [installed]

      mysql -uzabbix -p zabbix
      OUTPUT:

      +--------------------+
      | Database |
      +--------------------+
      | information_schema |
      | zabbix |
      +--------------------+
      2 rows in set (0.001 sec)
  • vladimir_lv
    Senior Member
    • May 2022
    • 240

    #3
    cannot use database "zabbix": its "users" table is empty
    Check if the user exists:
    Code:
    SELECT User, Host FROM mysql.user where user='zabbix';
    Check privileges granted to a 'zabbix; user account from a localhost:
    Code:
    SHOW GRANTS FOR 'zabbix'@'localhost';

    Comment

    • dimir
      Zabbix developer
      • Apr 2011
      • 1080

      #4
      Install mysql module for PHP
      Code:
      apt -y install php-mysql
      and restart apache.

      Comment


      • prisoner267
        prisoner267 commented
        Editing a comment
        I get this error:

        Setting up zabbix-server-pgsql (1:5.0.8+dfsg-1) ...
        ucfr: Attempt from package zabbix-server-pgsql to take /etc/zabbix/zabbix_server.conf away from package zabbix-server-mysql
        ucfr: Aborting.
        dpkg: error processing package zabbix-server-pgsql (--configure):
        installed zabbix-server-pgsql package post-installation script subprocess returned error exit status 4
        Setting up php-mysql (2:7.4+76) ...
        Processing triggers for libapache2-mod-php7.4 (7.4.30-1+deb11u1) ...
        Processing triggers for php7.4-cli (7.4.30-1+deb11u1) ...
        Errors were encountered while processing:
        zabbix-server-pgsql
        needrestart is being skipped since dpkg has failed
        Scanning application launchers
        Removing duplicate launchers or broken launchers
        Launchers are updated
        E: Sub-process /usr/bin/dpkg returned an error code (1)

        But now I see MySQL in the installation page but with an error:

        Unable to determine current Zabbix database version: the table "dbversion" was not found.
        Last edited by prisoner267; 03-08-2022, 20:52.
    • Markku
      Senior Member
      Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
      • Sep 2018
      • 1781

      #5
      zabbix-server-mysql/parrot,now 1:5.0.8+dfsg-1 amd64 [installed]
      Your zabbix-server package is installed from a Parrot repository, not from Zabbix official repository.

      I'd recommend uninstalling all those parrot packages and reinstalling them from the official Zabbix repository. Maybe you installed them before installing zabbix-release package (or running apt update)?

      Markku

      Comment


      • prisoner267
        prisoner267 commented
        Editing a comment
        after apt update:
        Hit:6 https://repo.zabbix.com/zabbix-agent2-plugins/1/debian bullseye InRelease
        Hit:7 https://repo.zabbix.com/zabbix/6.2/debian bullseye InRelease
        N: Skipping acquire of configured file 'main/binary-i386/Packages' as repository 'https://repo.zabbix.com/zabbix/6.2/debian bullseye InRelease' doesn't support architecture 'i386'


        after seeing the hits we can understand that indeed that's the zabbix repo because I install zabbix.deb. But at the last line throughs an error

        I tried
        sudo dpkg --add-architecture amd64

        still getting the same error after I do apt update:
        N: Skipping acquire of configured file 'main/binary-i386/Packages' as repository 'https://repo.zabbix.com/zabbix/6.2/debian bullseye InRelease' doesn't support architecture 'i386'
        Last edited by prisoner267; 03-08-2022, 20:52.

      • Markku
        Markku commented
        Editing a comment
        Ok, apparently the Parrot distro is not very compatible with Debian after all, so I don't have more specific ideas (other than installing on real Debian).

        Markku
    • prisoner267
      Junior Member
      • Jul 2022
      • 2

      #6
      Originally posted by vladimir_lv

      Check if the user exists:
      Code:
      SELECT User, Host FROM mysql.user where user='zabbix';
      --> ERROR 1142 (42000): SELECT command denied to user 'zabbix'@'localhost' for table 'user'

      Code:
      SHOW GRANTS FOR 'zabbix'@'localhost';
      --> GRANT ALL PRIVILEGES ON `zabbix`.* TO `zabbix`@`localhost

      again I tried
      Code:
      SELECT User, Host FROM mysql.user where user='zabbix';
      --> ERROR 1142 (42000): SELECT command denied to user 'zabbix'@'localhost' for table 'user'

      Comment

      Working...