最新的MySQL没有出现在Kubernetes

时间:2018-04-20 15:29:04

标签: mysql kubernetes

我在部署到kubernetes时看到容器中出现以下错误。我有一行

spec:
  containers:
  - name: mysql
    image: mysql/mysql-server:latest
    args:
      - "--ignore-db-dir=lost+found"

在配置中,我是否需要包含其他任何内容

[Entrypoint] MySQL Docker Image 8.0.11-1.1.5
[Entrypoint] Starting MySQL 8.0.11-1.1.5
2018-04-20T15:20:54.975756Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.11) starting as process 1
mysqld: Table 'mysql.plugin' doesn't exist
2018-04-20T15:20:55.415098Z 0 [ERROR] [MY-010735] [Server] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2018-04-20T15:20:55.495353Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2018-04-20T15:20:55.499087Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2018-04-20T15:20:55.505667Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2018-04-20T15:20:55.505905Z 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
2018-04-20T15:20:55.505932Z 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.
2018-04-20T15:20:55.506040Z 0 [ERROR] [MY-011071] [Server] unknown variable 'ignore-db-dir=lost+found'
2018-04-20T15:20:55.506057Z 0 [Warning] [MY-010952] [Server] The privilege system failed to initialize correctly. If you have upgraded your server, make sure you're executing mysql_upgrade to correct the issue.
2018-04-20T15:20:55.506137Z 0 [ERROR] [MY-010119] [Server] Aborting
2018-04-20T15:20:57.198050Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.11)  MySQL Community Server - GPL.nterval of mirrorId has elapsed or updates are forced -> [Help 1]

2 个答案:

答案 0 :(得分:2)

此特定错误是因为未正确指定--ignore-db-dir。不应使用=

从您的日志中可以看到以下内容

  

[服务器]未知变量' ignore-db-dir = lost + found'

由于此操作失败,因此无法正确处理ignore database目录选项。

理想情况下,我在下面提到的其他选项也应该是yaml文件的一部分。应设置root密码等参数。

  args:
    - "--ignore-db-dir"
    - "lost+found"
  env:
    - name: MYSQL_ROOT_PASSWORD
      # change this
      value: yourpassword
  ports:
    - containerPort: 3306
      name: mysql
  volumeMounts:
      # name must match the volume name below
    - name: mysql-persistent-storage
      # mount path within the container
      mountPath: /var/lib/mysql

答案 1 :(得分:0)

MySQL 8已删除不推荐使用的--ignore-db-dir选项,因为它不再需要显式忽略其数据字典中尚未存在的数据库目录。

因此,由于现在未知的选项而导致错误,可以将其删除。

由于数据字典提供了有关数据库对象的信息,因此服务器不再检查数据目录中的目录名称以查找数据库。因此,-ignore-db-dir选项是多余的,已被删除。要解决此问题,请从启动配置中删除--ignore-db-dir的所有实例

https://dev.mysql.com/doc/refman/8.0/en/upgrade-prerequisites.html的第11点起

这不是因为它像Jeevan所说的那样是一个--name = value