简体   繁体   中英

Latest MySQL not coming up in Kubernetes

I am seeing the following error in the container when deployed to the kubernetes. I have the line

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

in the config, do I need to include anything else

[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]

This specific error is because --ignore-db-dir is not specified correctly. = should not be used.

From your logs, the following can be seen

[Server] unknown variable 'ignore-db-dir=lost+found'

Since this fails, the ignore database directory option is not handled correctly.

Ideally, the additional options that I mentioned below should also be part of the yaml file. Parameters like root password should be set.

  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

MySQL 8 has removed the deprecated --ignore-db-dir option, due to no longer needing to explicitly ignore directories not already databases in its data dictionary.

Therefore it is erroring due to a now unknown option and can be removed.

Because the data dictionary provides information about database objects, the server no longer checks directory names in the data directory to find databases. Consequently, the --ignore-db-dir option is extraneous and has been removed. To handle this, remove any instances of --ignore-db-dir from your startup configuration

from point 11 of https://dev.mysql.com/doc/refman/8.0/en/upgrade-prerequisites.html

It is not because of it being a single --name=value as Jeevan says

请使用以下命令将 Kubernetes 与 docker 链接,

eval $(minikube docker-env)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM