docker-library / mysql

Docker Official Image packaging for MySQL Community Server
https://dev.mysql.com/
GNU General Public License v2.0
2.46k stars 2.19k forks source link

Can't open the mysql.plugin table. Please run mysql_upgrade to create it. in mysql pod #996

Closed codeRuslan closed 9 months ago

codeRuslan commented 1 year ago

I have this deployment.yaml which I use in Kubernetes, which I use to deploy an mysql container. I also have restarted it a few times, but nothing has helped yet..


  name: mysql-1
  namespace: test
  resourceVersion: "123213"
  uid: xxxxxx
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: mysql
      tier: mysql-1
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: mysql
        tier: mysql-1
    spec:
      containers:
      - env:
        - name: MYSQL_ROOT_PASSWORD
          valueFrom:
            secretKeyRef:
              key: rootPassword
              name: mysql-1-password
        image: mysql:5.6
        imagePullPolicy: IfNotPresent
        name: mysql-1
        ports:
        - containerPort: 3306
          name: mysql
          protocol: TCP
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /var/lib/mysql
          name: mysql-persistent-storage
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
      volumes:
      - name: mysql-persistent-storage
        persistentVolumeClaim:
          claimName: mysql-56-1-pvc

however it fails to start a pod with a following log output:

    2023-09-26 10:36:31 0 [Note] mysqld (mysqld 5.6.51) starting as process 1 ...
        2023-09-26 10:36:31 1 [Note] Plugin 'FEDERATED' is disabled.
        mysqld: Table 'mysql.plugin' doesn't exist
        2023-09-26 10:36:31 1 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
        2023-09-26 10:36:31 1 [Note] InnoDB: Using atomics to ref count buffer pool pages
        2023-09-26 10:36:31 1 [Note] InnoDB: The InnoDB memory heap is disabled
        2023-09-26 10:36:31 1 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
        2023-09-26 10:36:31 1 [Note] InnoDB: Memory barrier is not used
        2023-09-26 10:36:31 1 [Note] InnoDB: Compressed tables use zlib 1.2.11
        InnoDB: Warning: io_setup() attempt 1-5 failed.
        2023-09-26 10:36:34 7f2030a71040 InnoDB: Error: io_setup() failed with EAGAIN after 5 attempts.
        InnoDB: You can disable Linux Native AIO by setting innodb_use_native_aio = 0 in my.cnf
        2023-09-26 10:36:34 1 [ERROR] InnoDB: Fatal : Cannot initialize AIO sub-system
        2023-09-26 10:36:34 1 [ERROR] Plugin 'InnoDB' init function returned error.
        2023-09-26 10:36:34 1 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
        2023-09-26 10:36:34 1 [ERROR] Unknown/unsupported storage engine: InnoDB
        2023-09-26 10:36:34 1 [ERROR] Aborting

    2023-09-26 10:36:34 1 [Note] Binlog end

_Could you please what help what could be the main error, the error seems to be releated to this field in logs: mysqld: Table 'mysql.plugin' doesn't exist 2023-09-26 10:36:31 1 [ERROR] Can't open the mysql.plugin table. Please run mysqlupgrade to create it.

tianon commented 9 months ago

I think it wasn't until mysql:8 that mysql_upgrade was run automatically when necessary, so I think you'll need to run that manually? I think it might also be possible to trigger this error via data corruption?

tianon commented 9 months ago

Closing since I don't think there's anything we could change in the image here. :bow: