-1

I am deploying a zabbix-server. I created a MySQL database on the a cloud platform. When I start the zabbix-server-mysql:alpine-5.2-latest container which connects to this DB, it automatically exits after a while. The log shows:

* Preparing Zabbix server
** Using MYSQL_USER variable from ENV
** Using MYSQL_PASSWORD variable from ENV
********************
* DB_SERVER_HOST: xxxxx
* DB_SERVER_PORT: 3306
* DB_SERVER_DBNAME: zabbix
********************
** Database 'zabbix' already exists. Please be careful with database COLLATE!
** Creating 'zabbix' schema in MySQL
ERROR 1071 (42000) at line 357: Specified key was too long; max key length is 3072 bytes
** Preparing Zabbix server configuration file
** Updating '/etc/zabbix/zabbix_server.conf' parameter "ListenPort": ''...removed
** Updating '/etc/zabbix/zabbix_server.conf' parameter "SourceIP": ''...removed
...
** Updating '/etc/zabbix/zabbix_server.conf' parameter "TLSPSKIdentity": ''...removed
** Updating '/etc/zabbix/zabbix_server.conf' parameter "TLSPSKFile": ''...removed
** Updating '/etc/zabbix/zabbix_server.conf' parameter "User": 'zabbix'...updated
Starting Zabbix Server. Zabbix 5.2.3 (revision ae46273).
Press Ctrl+C to exit.

     8:20210125:093824.714 Starting Zabbix Server. Zabbix 5.2.3 (revision ae46273).
     8:20210125:093824.714 ****** Enabled features ******
     8:20210125:093824.714 SNMP monitoring:           YES
     8:20210125:093824.714 IPMI monitoring:           YES
     8:20210125:093824.714 Web monitoring:            YES
     8:20210125:093824.714 VMware monitoring:         YES
     8:20210125:093824.714 SMTP authentication:       YES
     8:20210125:093824.714 ODBC:                      YES
     8:20210125:093824.714 SSH support:               YES
     8:20210125:093824.714 IPv6 support:              YES
     8:20210125:093824.714 TLS support:               YES
     8:20210125:093824.714 ******************************
     8:20210125:093824.714 using configuration file: /etc/zabbix/zabbix_server.conf
     8:20210125:093824.946 cannot use database "zabbix": its "users" table is empty (is this the Zabbix proxy database?)

It can connect to MySQL and create some tables including the users table.

When I restart the container, the same error shows up again.

WYC
  • 599
  • 6
  • 6
  • This question has nothing to do with programming, therefore it is off topic here on SO. Serverfault sister site of SO offers help in server configuration questions. – Shadow Jan 26 '21 at 02:42

3 Answers3

2

I found https://github.com/zabbix/zabbix-docker/issues/13 and so deduced that it is a problem about the MySQL Database collation (and this matches the warning ** Database 'zabbix' already exists. Please be careful with database COLLATE!)

I solve the problem by re-creating the MySQL database with

  1. charset: utf8
  2. collation: utf8_bin
WYC
  • 599
  • 6
  • 6
  • Nice bro, it turns out i was creating MySQL database with utf8mb4 and utf8mb4_bin and after recreating the database with utf8 the problem was solved! – Raul Chiarella Dec 29 '21 at 16:48
  • I still had issues even with creating the database with the right charset and collation. Turns out before Zabbix server can deploy its SQL scripts you need to login to your MySQL server as root and execute `set global log_bin_trust_function_creators = 1;`. Then let Zabbix server run its SQL scripts. Afterwards you can disable this setting by running `set global log_bin_trust_function_creators = 0;`. This is also explained here https://www.zabbix.com/documentation/current/en/manual/appendix/install/db_scripts – Htbaa May 10 '23 at 08:41
0

I met the same problem when I imported a zabbix appliance to KVM. I solved it by dropping the zabbix database in MySQL and create it again and populate it with the DB script according to the zabbix installation documents.

Fatalerr
  • 291
  • 2
  • 6
0

For Zabbix installation using docker, you have to drop the Zabbix database in the MySQL container for this error to be resolved.

  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 21 '21 at 08:42