docker部署zabbix、mysql8.0遇到的问题

1.启动命令

docker run --name mysql-server -t \
      -e MYSQL_DATABASE="zabbix" \
      -e MYSQL_USER="zabbix" \
      -e MYSQL_PASSWORD="zabbix" \
      -e MYSQL_ROOT_PASSWORD="123456" \
      -d mysql:8.0 \
      --restart unless-stopped \
      --character-set-server=utf8 --collation-server=utf8_bin \
      --default-authentication-plugin=mysql_native_password

2.查看报错日志

2021-01-16 03:33:39+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.22-1debian10 started.
2021-01-16 03:33:39+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2021-01-16 03:33:39+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.22-1debian10 started.
2021-01-16 03:33:39+00:00 [Note] [Entrypoint]: Initializing database files
2021-01-16T03:33:39.939639Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.22) initializing of server in progress as process 42
2021-01-16T03:33:39.940557Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2021-01-16T03:33:39.940566Z 0 [Warning] [MY-013244] [Server] --collation-server: 'utf8_bin' is a collation of the deprecated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate collation instead.
2021-01-16T03:33:39.946285Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-01-16T03:33:41.145940Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-01-16T03:33:43.036463Z 0 [ERROR] [MY-000068] [Server] unknown option '--restart'.
2021-01-16T03:33:43.036849Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.
2021-01-16T03:33:43.037485Z 0 [ERROR] [MY-010119] [Server] Aborting
2021-01-16T03:33:45.836292Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.22)  MySQL Community Server - GPL.

3.解决方案

把 --restart unless-stopped 参数放到镜像名字前面
正确启动命令

docker run --name mysql-server -t \
       -e MYSQL_DATABASE="zabbix" \
       -e MYSQL_USER="zabbix" \
       -e MYSQL_PASSWORD="zabbix" \
       -e MYSQL_ROOT_PASSWORD="123456" \
      --restart unless-stopped \
      -d mysql:8.0 \
      --character-set-server=utf8 --collation-server=utf8_bin \
       --default-authentication-plugin=mysql_native_password

解决掉了!!!

  • 4
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值