相关文章推荐
大方的酸菜鱼  ·  Search Results | ...·  4 月前    · 
快乐的哑铃  ·  Could not find ...·  10 月前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Cannot start docker image of zabbix-server-mysql: 'cannot use database "zabbix": its "users" table is empty (is this the Zabbix proxy database?)'

Ask Question

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.

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, 2021 at 2:42

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

  • charset: utf8
  • collation: utf8_bin
  • 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, 2021 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 zabbix.com/documentation/current/en/manual/appendix/install/… – Htbaa May 10 at 8:41 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. – Community Dec 21, 2021 at 8:42

    Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question. Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers.