为什么我可以使用卷参数启动容器

时间:2019-09-05 10:21:40

标签: mysql docker docker-compose

我的问题是,当我在不指定volume参数的情况下启动映像时,一切都很好。但是当我指定容器不能以以下错误开始时...

这是我的docker-compose:

version: '3.7'
# Use root/example as user/password credentials
services:

  db:
    image: mysql:8.0
    command: --default-authentication-plugin=mysql_native_password
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: 123zemtsov321
    volumes:
      - ./docker/database/mysql01:/var/lib/mysql

  adminer:
    image: adminer
    restart: always
    ports:
      - 6080:8080

db_1       | mysqld: Table 'mysql.plugin' doesn't exist
db_1       | 2019-09-05T10:16:32.860733Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
db_1       | 2019-09-05T10:16:32.861130Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.17) starting as process 1
db_1       | 2019-09-05T10:16:34.628973Z 0 [ERROR] [MY-010735] [Server] Could not open the mysql.plugin table. Please perform the MySQL upgrade procedure.
db_1       | 2019-09-05T10:16:34.737017Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
db_1       | 2019-09-05T10:16:34.788763Z 0 [Warning] [MY-000054] [Server] World-writable config file './auto.cnf' is ignored.
db_1       | 2019-09-05T10:16:34.789050Z 0 [Warning] [MY-010107] [Server] World-writable config file './auto.cnf' has been removed.
db_1       | 2019-09-05T10:16:34.789371Z 0 [Warning] [MY-010075] [Server] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 3d261de8-cfc6-11e9-a284-0242ac120003.
db_1       | 2019-09-05T10:16:34.922344Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
db_1       | 2019-09-05T10:16:34.958036Z 0 [Warning] [MY-010069] [Server] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
db_1       | 2019-09-05T10:16:34.958975Z 0 [Warning] [MY-010284] [Server] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work.
db_1       | 2019-09-05T10:16:34.959371Z 0 [Warning] [MY-010284] [Server] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work.
db_1       | 2019-09-05T10:16:34.964792Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
db_1       | 2019-09-05T10:16:34.965651Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
db_1       | 2019-09-05T10:16:34.966395Z 0 [ERROR] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-001146 - Table 'mysql.component' doesn't exist
db_1       | 2019-09-05T10:16:34.966438Z 0 [Warning] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-003543 - The mysql.component table is missing or has an incorrect definition.
db_1       | 2019-09-05T10:16:34.968178Z 0 [ERROR] [MY-010326] [Server] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
db_1       | 2019-09-05T10:16:34.968332Z 0 [ERROR] [MY-010952] [Server] The privilege system failed to initialize correctly. For complete instructions on how to upgrade MySQL to a new version please see the 'Upgrading MySQL' section from the MySQL manual.
db_1       | 2019-09-05T10:16:34.969207Z 0 [ERROR] [MY-010119] [Server] Aborting
db_1       | 2019-09-05T10:16:35.815514Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.17)  MySQL Community Server - GPL.
work_db_1 exited with code 1

为什么我会得到这个错误????

1 个答案:

答案 0 :(得分:1)

启动时似乎是由./docker/database/mysql01中的当前内容引起的。我将通过在文件系统上的不同位置上安装来开始故障排除(以查看重新开始是否解决了该问题),或者深入研究现有内容以消除造成故障的原因。这篇文章(虽然很旧)看起来可以解决与您遇到的情况类似的错误:

https://ma.ttias.be/mysql-table-mysql-plugin-doesnt-exist-after-mysql-upgrade/