title: Mysql keeps on restarting and shutdown in docker
body: <pre><code>my-admin-db.com_1       | 2020-09-08T06:05:23.367975Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
  my-admin-db.com_1       | 2020-09-08T06:05:23.369624Z 0 [Note] mysqld (mysqld 5.7.31) starting as process 1 ...
  my-admin-db.com_1       | 2020-09-08T06:05:23.372921Z 0 [Note] InnoDB: PUNCH HOLE support available
  my-admin-db.com_1       | 2020-09-08T06:05:23.372942Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
  my-admin-db.com_1       | 2020-09-08T06:05:23.372947Z 0 [Note] InnoDB: Uses event mutexes
  my-admin-db.com_1       | 2020-09-08T06:05:23.372952Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
  my-admin-db.com_1       | 2020-09-08T06:05:23.372968Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
  my-admin-db.com_1       | 2020-09-08T06:05:23.372972Z 0 [Note] InnoDB: Using Linux native AIO
  my-admin-db.com_1       | 2020-09-08T06:05:23.373291Z 0 [Note] InnoDB: Number of pools: 1
  my-admin-db.com_1       | 2020-09-08T06:05:23.373432Z 0 [Note] InnoDB: Using CPU crc32 instructions
  my-admin-db.com_1       | 2020-09-08T06:05:23.375506Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
  my-admin-db.com_1       | 2020-09-08T06:05:23.388608Z 0 [Note] InnoDB: Completed initialization of buffer pool
  my-admin-db.com_1       | 2020-09-08T06:05:23.391222Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
  my-admin-db.com_1       | 2020-09-08T06:05:23.403447Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
  my-admin-db.com_1       | 2020-09-08T06:05:23.474527Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
  my-admin-db.com_1       | 2020-09-08T06:05:23.474621Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
  my-admin-db.com_1       | 2020-09-08T06:05:23.680361Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
  my-admin-db.com_1       | 2020-09-08T06:05:23.682461Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
  my-admin-db.com_1       | 2020-09-08T06:05:23.682498Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
  my-admin-db.com_1       | 2020-09-08T06:05:23.683937Z 0 [Note] InnoDB: 5.7.31 started; log sequence number 13805196
  my-admin-db.com_1       | 2020-09-08T06:05:23.685254Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
  my-admin-db.com_1       | 2020-09-08T06:05:23.685303Z 0 [Note] Plugin 'FEDERATED' is disabled.
  my-admin-db.com_1       | 2020-09-08T06:05:23.690345Z 0 [Note] InnoDB: Buffer pool(s) load completed at 200908  2:05:23
  my-admin-db.com_1       | 2020-09-08T06:05:23.696899Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
  my-admin-db.com_1       | 2020-09-08T06:05:23.696919Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
  my-admin-db.com_1       | 2020-09-08T06:05:23.697738Z 0 [Warning] CA certificate ca.pem is self signed.
  my-admin-db.com_1       | 2020-09-08T06:05:23.697786Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
  my-admin-db.com_1       | 2020-09-08T06:05:23.698319Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
  my-admin-db.com_1       | 2020-09-08T06:05:23.698458Z 0 [Note] IPv6 is available.
  my-admin-db.com_1       | 2020-09-08T06:05:23.698525Z 0 [Note]   - '::' resolves to '::';
  my-admin-db.com_1       | 2020-09-08T06:05:23.698560Z 0 [Note] Server socket created on IP: '::'.
  my-admin-db.com_1       | 2020-09-08T06:05:23.736220Z 0 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
  my-admin-db.com_1       | 2020-09-08T06:05:23.737779Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
  my-admin-db.com_1       | 2020-09-08T06:05:23.737819Z 0 [ERROR] Fatal error: Failed to initialize ACL/grant/time zones structures or failed to remove temporary table files.
  my-admin-db.com_1       | 2020-09-08T06:05:23.738067Z 0 [ERROR] Aborting
  my-admin-db.com_1       | 
  my-admin-db.com_1       | 2020-09-08T06:05:23.738146Z 0 [Note] Binlog end
  my-admin-db.com_1       | 2020-09-08T06:05:23.738271Z 0 [Note] Shutting down plugin 'ngram'
  my-admin-db.com_1       | 2020-09-08T06:05:23.738288Z 0 [Note] Shutting down plugin 'partition'
  my-admin-db.com_1       | 2020-09-08T06:05:23.738298Z 0 [Note] Shutting down plugin 'BLACKHOLE'
  my-admin-db.com_1       | 2020-09-08T06:05:23.738308Z 0 [Note] Shutting down plugin 'ARCHIVE'
  my-admin-db.com_1       | 2020-09-08T06:05:23.738316Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
  my-admin-db.com_1       | 2020-09-08T06:05:23.738539Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
  my-admin-db.com_1       | 2020-09-08T06:05:23.738553Z 0 [Note] Shutting down plugin 'MyISAM'
  my-admin-db.com_1       | 2020-09-08T06:05:23.738589Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
  my-admin-db.com_1       | 2020-09-08T06:05:23.738711Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
  my-admin-db.com_1       | 2020-09-08T06:05:23.738934Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
  my-admin-db.com_1       | 2020-09-08T06:05:23.738965Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
  my-admin-db.com_1       | 2020-09-08T06:05:23.738975Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
  my-admin-db.com_1       | 2020-09-08T06:05:23.738984Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
  my-admin-db.com_1       | 2020-09-08T06:05:23.738992Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
  my-admin-db.com_1       | 2020-09-08T06:05:23.739000Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
  my-admin-db.com_1       | 2020-09-08T06:05:23.739008Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
  my-admin-db.com_1       | 2020-09-08T06:05:23.739017Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
  my-admin-db.com_1       | 2020-09-08T06:05:23.739025Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
  my-admin-db.com_1       | 2020-09-08T06:05:23.739033Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
  my-admin-db.com_1       | 2020-09-08T06:05:23.739042Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
  my-admin-db.com_1       | 2020-09-08T06:05:23.739052Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
  my-admin-db.com_1       | 2020-09-08T06:05:23.739060Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
  my-admin-db.com_1       | 2020-09-08T06:05:23.739069Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
  my-admin-db.com_1       | 2020-09-08T06:05:23.739078Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
  my-admin-db.com_1       | 2020-09-08T06:05:23.739087Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
  my-admin-db.com_1       | 2020-09-08T06:05:23.739095Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
  my-admin-db.com_1       | 2020-09-08T06:05:23.739104Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
  my-admin-db.com_1       | 2020-09-08T06:05:23.739113Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
  my-admin-db.com_1       | 2020-09-08T06:05:23.739121Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
  my-admin-db.com_1       | 2020-09-08T06:05:23.739129Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
  my-admin-db.com_1       | 2020-09-08T06:05:23.739137Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
  my-admin-db.com_1       | 2020-09-08T06:05:23.739146Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
  my-admin-db.com_1       | 2020-09-08T06:05:23.739154Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
  my-admin-db.com_1       | 2020-09-08T06:05:23.739162Z 0 [Note] Shutting down plugin 'INNODB_CMP'
  my-admin-db.com_1       | 2020-09-08T06:05:23.739171Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
  my-admin-db.com_1       | 2020-09-08T06:05:23.739180Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
  my-admin-db.com_1       | 2020-09-08T06:05:23.739189Z 0 [Note] Shutting down plugin 'INNODB_TRX'
  my-admin-db.com_1       | 2020-09-08T06:05:23.739197Z 0 [Note] Shutting down plugin 'InnoDB'
  my-admin-db.com_1       | 2020-09-08T06:05:23.739377Z 0 [Note] InnoDB: FTS optimize thread exiting.
  my-admin-db.com_1       | 2020-09-08T06:05:23.739810Z 0 [Note] InnoDB: Starting shutdown...
  my-admin-db.com_1       | 2020-09-08T06:05:23.840672Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
  my-admin-db.com_1       | 2020-09-08T06:05:23.841296Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 200908  2:05:23
  my-admin-db.com_1       | 2020-09-08T06:05:25.509915Z 0 [Note] InnoDB: Shutdown completed; log sequence number 13805215
  my-admin-db.com_1       | 2020-09-08T06:05:25.511721Z 0 [Note] InnoDB: Removed temporary tablespace data file: &quot;ibtmp1&quot;
  my-admin-db.com_1       | 2020-09-08T06:05:25.511744Z 0 [Note] Shutting down plugin 'MEMORY'
  my-admin-db.com_1       | 2020-09-08T06:05:25.511751Z 0 [Note] Shutting down plugin 'CSV'
  my-admin-db.com_1       | 2020-09-08T06:05:25.511757Z 0 [Note] Shutting down plugin 'sha256_password'
  my-admin-db.com_1       | 2020-09-08T06:05:25.511761Z 0 [Note] Shutting down plugin 'mysql_native_password'
  my-admin-db.com_1       | 2020-09-08T06:05:25.511935Z 0 [Note] Shutting down plugin 'binlog'
  my-admin-db.com_1       | 2020-09-08T06:05:25.512173Z 0 [Note] mysqld: Shutdown complete
  </code></pre>
  <p><strong>This is my docker compose yml file.</strong></p>
  <pre><code>version: '2'
  services:
    my-admin-db.com:
      image: mysql:5.7
      volumes_from:
        - my-admin-db-data.com
      ports:
        - &quot;3307:3306&quot;
      environment:
        TZ: &quot;US/Eastern&quot;
        JAVA_OPTS: -Xms128m
        MYSQL_ROOT_PASSWORD: root
        MYSQL_DATABASE: root
      restart: always 
      mem_limit: 512m
    my-admin-db-data.com:
      image: busybox
      volumes:
        - ~/docker/mysql/my_admin:/var/lib/mysql
  
    my-db.com:
      image: mysql:5.7
      volumes_from:
        - my-db-data.com
      environment:
        TZ: &quot;US/Eastern&quot;
        JAVA_OPTS: -Xms128m
        MYSQL_ROOT_PASSWORD: root
        MYSQL_DATABASE: root
      ports:
        - &quot;3352:3306&quot;
      restart: always
      mem_limit: 512m
    my-db-data.com:
      image: busybox
      volumes:
        - ~/docker/mysql/my_db:/var/lib/mysql
  </code></pre>
  <p>I have two mysql instance in my docker yml. One is working fine while another is creating error. I have also tried to change the mysql port and removing the existing container but still it is giving me same error.</p>
  <p>It looks like the error coming from here</p>
  <pre><code>Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
  my-admin-db.com_1       | 2020-09-08T06:05:23.737819Z 0 [ERROR] Fatal error: Failed to initialize ACL/grant/time zones structures or failed to remove temporary table files.
  </code></pre>
  <p>But I am not able to figure it out.
  Any help would be appreciated</p>