MySQL:8.0 is taking unusual time to Initialize in Docker

4/9/2018

Official mysql:8.0 (aka 8.0.4) image is taking unusual time (approximately 10+ minutes) to initialize the database in docker (local machine).

If you look closely at log's time, the last line took 7 minutes to execute.

Initializing database
2018-04-09T10:00:29.926078Z 0 [Warning] [MY-011070] 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.
2018-04-09T10:00:29.926165Z 0 [System] [MY-010116] /usr/sbin/mysqld (mysqld 8.0.4-rc) starting as process 30 ...
mbind: Operation not permitted
mbind: Operation not permitted
mbind: Operation not permitted
mbind: Operation not permitted
2018-04-09T10:00:46.842725Z 0 [Warning] [MY-010068] CA certificate ca.pem is self signed.
2018-04-09T10:00:46.903128Z 5 [Warning] [MY-010453] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2018-04-09T10:07:28.643932Z 5 [Warning] [MY-010315] 'user' entry 'mysql.infoschema@localhost' ignored in --skip-name-resolve mode.

For your Information, in this same machine, mysql:8.0.3 doesn't take much time at all to Initialize the Database.

Here is my configuration:

OS: ubuntu 16.04

$ docker version
Client:
 Version:   17.12.1-ce
 API version:   1.35
 Go version:    go1.9.4
 Git commit:    7390fc6
 Built: Tue Feb 27 22:17:40 2018
 OS/Arch:   linux/amd64

Server:
 Engine:
  Version:  17.12.1-ce
  API version:  1.35 (minimum version 1.12)
  Go version:   go1.9.4
  Git commit:   7390fc6
  Built:    Tue Feb 27 22:16:13 2018
  OS/Arch:  linux/amd64
  Experimental: false

Process to recreate and full log:

$ docker pull mysql:8.0
8.0: Pulling from library/mysql
2a72cbf407d6: Pull complete 
38680a9b47a8: Pull complete 
4c732aa0eb1b: Pull complete 
c5317a34eddd: Pull complete 
f92be680366c: Pull complete 
e8ecd8bec5ab: Pull complete 
2a650284a6a8: Pull complete 
5127cdce4b46: Pull complete 
e20139ed3159: Pull complete 
4c9ba8a8a3da: Pull complete 
16cd0f3afb27: Pull complete 
0e4872d58e1f: Pull complete 
Digest: sha256:7004063f8bd0c7bade8d1c526b9b8f5188c8288f411d76ee4ba83131e00c6f02
Status: Downloaded newer image for mysql:8.0

$ docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:8.0
b9c5d67233743dc085c50244526f5b12bd862cd50cdc0cb889b2dc549c4a396d

$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
b9c5d6723374        mysql:8.0           "docker-entrypoint.s…"   5 seconds ago       Up 3 seconds        3306/tcp            some-mysql

$ docker logs -f b9c5d6723374
Initializing database
2018-04-09T10:00:29.926078Z 0 [Warning] [MY-011070] 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.
2018-04-09T10:00:29.926165Z 0 [System] [MY-010116] /usr/sbin/mysqld (mysqld 8.0.4-rc) starting as process 30 ...
mbind: Operation not permitted
mbind: Operation not permitted
mbind: Operation not permitted
mbind: Operation not permitted
2018-04-09T10:00:46.842725Z 0 [Warning] [MY-010068] CA certificate ca.pem is self signed.
2018-04-09T10:00:46.903128Z 5 [Warning] [MY-010453] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2018-04-09T10:07:28.643932Z 5 [Warning] [MY-010315] 'user' entry 'mysql.infoschema@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:28.644008Z 5 [Warning] [MY-010315] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:28.644033Z 5 [Warning] [MY-010315] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:28.644051Z 5 [Warning] [MY-010315] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:28.644082Z 5 [Warning] [MY-010323] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:28.644094Z 5 [Warning] [MY-010323] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:28.644112Z 5 [Warning] [MY-010311] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:28.644240Z 5 [Warning] [MY-010330] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:28.644257Z 5 [Warning] [MY-010330] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
Database initialized
MySQL init process in progress...
2018-04-09T10:07:44.797619Z 0 [Warning] [MY-011070] 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.
2018-04-09T10:07:44.797712Z 0 [System] [MY-010116] /usr/sbin/mysqld (mysqld 8.0.4-rc-log) starting as process 64 ...
mbind: Operation not permitted
mbind: Operation not permitted
mbind: Operation not permitted
mbind: Operation not permitted
MySQL init process in progress...
2018-04-09T10:07:45.990317Z 0 [Warning] [MY-010068] CA certificate ca.pem is self signed.
2018-04-09T10:07:46.040103Z 0 [Warning] [MY-000000] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2018-04-09T10:07:46.046970Z 0 [Warning] [MY-010315] 'user' entry 'mysql.infoschema@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:46.047013Z 0 [Warning] [MY-010315] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:46.047029Z 0 [Warning] [MY-010315] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:46.047046Z 0 [Warning] [MY-010315] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:46.047078Z 0 [Warning] [MY-010323] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:46.047091Z 0 [Warning] [MY-010323] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:46.047107Z 0 [Warning] [MY-010311] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:46.050079Z 0 [Warning] [MY-010330] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:46.050115Z 0 [Warning] [MY-010330] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:46.058044Z 0 [System] [MY-010931] /usr/sbin/mysqld: ready for connections. Version: '8.0.4-rc-log'  socket: '/var/run/mysqld/mysqld.sock'  port: 0  MySQL Community Server (GPL).
Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.
2018-04-09T10:07:50.304129Z 9 [Warning] [MY-010315] 'user' entry 'mysql.infoschema@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:50.304156Z 9 [Warning] [MY-010315] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:50.304166Z 9 [Warning] [MY-010315] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:50.304175Z 9 [Warning] [MY-010315] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:50.304197Z 9 [Warning] [MY-010323] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:50.304207Z 9 [Warning] [MY-010323] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:50.304218Z 9 [Warning] [MY-010311] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:50.304321Z 9 [Warning] [MY-010330] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:50.304332Z 9 [Warning] [MY-010330] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.

2018-04-09T10:07:53.074527Z 0 [System] [MY-010910] /usr/sbin/mysqld: Shutdown complete.

MySQL init process done. Ready for start up.

2018-04-09T10:07:53.336773Z 0 [Warning] [MY-011070] 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.
2018-04-09T10:07:53.336883Z 0 [System] [MY-010116] /usr/sbin/mysqld (mysqld 8.0.4-rc-log) starting as process 1 ...
mbind: Operation not permitted
mbind: Operation not permitted
mbind: Operation not permitted
mbind: Operation not permitted
2018-04-09T10:07:54.704270Z 0 [Warning] [MY-010068] CA certificate ca.pem is self signed.
2018-04-09T10:07:54.833645Z 0 [Warning] [MY-000000] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2018-04-09T10:07:54.841847Z 0 [Warning] [MY-010315] 'user' entry 'mysql.infoschema@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:54.841879Z 0 [Warning] [MY-010315] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:54.841894Z 0 [Warning] [MY-010315] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:54.841908Z 0 [Warning] [MY-010315] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:54.841931Z 0 [Warning] [MY-010323] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:54.841940Z 0 [Warning] [MY-010323] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:54.841953Z 0 [Warning] [MY-010311] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:54.844864Z 0 [Warning] [MY-010330] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:54.844947Z 0 [Warning] [MY-010330] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:54.850382Z 0 [System] [MY-010931] /usr/sbin/mysqld: ready for connections. Version: '8.0.4-rc-log'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server (GPL).

Furthermore, this image is taking more than 25 minutes in minikube to initialize the database.

Minikube's Configuration:

Environment:

  • Minikube version : v0.25.2
  • OS : Ubuntu 16.04.4 LTS
  • VM Driver : virtualbox
  • ISO version : minikube-v0.25.1.iso

The yaml file I used:

apiVersion: v1
kind: Namespace
metadata:
  name: demo
spec:
  finalizers:
  - kubernetes
---
apiVersion: v1
kind: Service
metadata:
  name: mysql-gvr
  namespace: demo
spec:
  clusterIP: None
  sessionAffinity: None
  type: ClusterIP

---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  labels:
    app: mysql
  name: mysql-8
  namespace: demo
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mysql
  serviceName: mysql-gvr
  template:
    metadata:
      labels:
        app: mysql
    spec:
      containers:
      - env:
        - name: MYSQL_ROOT_PASSWORD
          value : "test"
        image: mysql:8.0
        name: mysql
        ports:
        - containerPort: 3306
          name: db
          protocol: TCP
        volumeMounts:
        - mountPath: /var/lib/mysql
          name: data
  volumeClaimTemplates:
  - metadata:
      annotations:
        volume.beta.kubernetes.io/storage-class: standard
      name: data
    spec:
      accessModes:
      - ReadWriteOnce
      resources:
        requests:
          storage: 1Gi
      storageClassName: standard
---
apiVersion: v1
kind: Service
metadata:
  name: mysql
  namespace: demo
  labels:
    name: mysql
spec:
  ports:
    - port: 3306
  selector:
    name: mysql

Is this because mysql:8.0.4 is using new base image debian:stretch? Any guideline will be appreciated.

I have also created an issue in github docker-library/mysql repository to have the track of the issue. Here is the issue link.

-- Abdullah Al Maruf - Tuhin
docker
kubernetes
minikube
mysql

1 Answer

2/5/2019

Looks like, it was an issue of slow storage. After upgrading my disk to SSD, the waiting time improved drastically.

My minikube memory was 4GB in both my previous and current setup. But, SSD is making a huge difference.

-- Abdullah Al Maruf - Tuhin
Source: StackOverflow