Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.6k views
in Technique[技术] by (71.8m points)

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

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.

question from:https://stackoverflow.com/questions/65895096/cannot-start-docker-image-of-zabbix-server-mysql-cannot-use-database-zabbix

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...