简体   繁体   中英

Mysql won't start using Dockerfile

I am trying to install mysql non-interactively (without being asked any configuration questions) with the Dockerfile, and I found the solution to how to do that in : how to use here-strings in the Dockerfile?

but now I am facing another problem when I am trying to start mysql using service mysql start inside the container It won't work and I wonder why? because it was working perfectly when I was doing the installation manually inside the container of debian:buster image.

As you can see in the following it won't start :

root@839a7dc4869a:/# service --status-all
 [ ? ]  hwclock.sh
 [ - ]  mysql
root@839a7dc4869a:/# service mysql start
....................................................................................
....................................................................................
[info] MySQL Community Server 5.7.28 did not start. Please check logs for more details..

and this is my Dockerfile:

From debian:buster

RUN apt update

RUN apt install -y gnupg wget lsb-release

RUN wget https://dev.mysql.com/get/mysql-apt-config_0.8.13-1_all.deb

RUN printf "1\n1\n4\n" | dpkg -i mysql-apt-config_0.8.13-1_all.deb

RUN apt update

RUN printf '%s\n' 'mysql-community-server mysql-community-server/root-pass password your_password' | debconf-set-selections && \
    printf '%s\n' 'mysql-community-server mysql-community-server/re-root-pass password your_password' | debconf-set-selections && \
    apt-get -y install mysql-server

CMD bash

this is the logfile using less /var/log/mysql/error.log

2020-01-07T21:47:54.400816Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-01-07T21:47:55.708390Z 0 [Warning] InnoDB: New log files created, LSN=45790
2020-01-07T21:47:55.886509Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2020-01-07T21:47:56.038387Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 5d1f693e-3197-11ea-95e2-0242ac110002.
2020-01-07T21:47:56.040635Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2020-01-07T21:47:56.456659Z 0 [Warning] CA certificate ca.pem is self signed.
2020-01-07T21:47:56.740853Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2020-01-07T21:47:59.268086Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-01-07T21:47:59.269832Z 0 [Note] mysqld (mysqld 5.7.28) starting as process 334 ...
2020-01-07T21:47:59.274112Z 0 [Note] InnoDB: PUNCH HOLE support available
2020-01-07T21:47:59.274187Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-01-07T21:47:59.274191Z 0 [Note] InnoDB: Uses event mutexes
2020-01-07T21:47:59.274194Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2020-01-07T21:47:59.274196Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-01-07T21:47:59.274199Z 0 [Note] InnoDB: Using Linux native AIO
2020-01-07T21:47:59.274482Z 0 [Note] InnoDB: Number of pools: 1
2020-01-07T21:47:59.274639Z 0 [Note] InnoDB: Using CPU crc32 instructions
2020-01-07T21:47:59.276370Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2020-01-07T21:47:59.281119Z 0 [Note] InnoDB: Completed initialization of buffer pool
2020-01-07T21:47:59.282302Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2020-01-07T21:47:59.294898Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2020-01-07T21:47:59.301611Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2020-01-07T21:47:59.301665Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2020-01-07T21:47:59.344888Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2020-01-07T21:47:59.345338Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2020-01-07T21:47:59.345345Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2020-01-07T21:47:59.346096Z 0 [Note] InnoDB: Waiting for purge to start
2020-01-07T21:47:59.396626Z 0 [Note] InnoDB: 5.7.28 started; log sequence number 2628227
2020-01-07T21:47:59.396804Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2020-01-07T21:47:59.396852Z 0 [Note] Plugin 'FEDERATED' is disabled.
2020-01-07T21:47:59.397717Z 0 [Note] InnoDB: Buffer pool(s) load completed at 200107 21:47:59
2020-01-07T21:47:59.400400Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2020-01-07T21:47:59.400413Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2020-01-07T21:47:59.400770Z 0 [Warning] CA certificate ca.pem is self signed.
2020-01-07T21:47:59.400790Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2020-01-07T21:47:59.400992Z 0 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
2020-01-07T21:47:59.401006Z 0 [Note]   - '127.0.0.1' resolves to '127.0.0.1';
2020-01-07T21:47:59.401021Z 0 [Note] Server socket created on IP: '127.0.0.1'.
2020-01-07T21:47:59.403395Z 0 [Warning] Insecure configuration for --pid-file: Location '/tmp' in the path is accessible to all OS users. Consider choosing a different directory.
2020-01-07T21:47:59.408666Z 0 [Note] Event Scheduler: Loaded 0 events
2020-01-07T21:47:59.408808Z 0 [Note] Execution of init_file '/var/lib/mysql-files/7pxJ7t37bI' started.
2020-01-07T21:47:59.409234Z 0 [Note] Execution of init_file '/var/lib/mysql-files/7pxJ7t37bI' ended.
2020-01-07T21:47:59.409284Z 0 [Note] mysqld: ready for connections.
Version: '5.7.28'  socket: '/tmp/tmp.q7db4MMdAE/mysqld.sock'  port: 3306  MySQL Community Server (GPL)
2020-01-07T21:47:59.409594Z 0 [Note] Giving 0 client threads a chance to die gracefully
2020-01-07T21:47:59.409606Z 0 [Note] Shutting down slave threads
2020-01-07T21:47:59.409609Z 0 [Note] Forcefully disconnecting 0 remaining clients
2020-01-07T21:47:59.409612Z 0 [Note] Event Scheduler: Purging the queue. 0 events
2020-01-07T21:47:59.409663Z 0 [Note] Binlog end
2020-01-07T21:47:59.409938Z 0 [Note] Shutting down plugin 'ngram'
2020-01-07T21:47:59.409944Z 0 [Note] Shutting down plugin 'partition'
2020-01-07T21:47:59.409946Z 0 [Note] Shutting down plugin 'BLACKHOLE'
2020-01-07T21:47:59.409948Z 0 [Note] Shutting down plugin 'ARCHIVE'
2020-01-07T21:47:59.409950Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2020-01-07T21:47:59.409962Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
2020-01-07T21:47:59.409964Z 0 [Note] Shutting down plugin 'MyISAM'
2020-01-07T21:47:59.409969Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
2020-01-07T21:47:59.409971Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2020-01-07T21:47:59.409973Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2020-01-07T21:47:59.409975Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2020-01-07T21:47:59.409976Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2020-01-07T21:47:59.409978Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2020-01-07T21:47:59.409980Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2020-01-07T21:47:59.409981Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2020-01-07T21:47:59.409983Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2020-01-07T21:47:59.409985Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2020-01-07T21:47:59.409986Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2020-01-07T21:47:59.409988Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2020-01-07T21:47:59.409990Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2020-01-07T21:47:59.409991Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2020-01-07T21:47:59.409993Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2020-01-07T21:47:59.409995Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2020-01-07T21:47:59.409996Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
2020-01-07T21:47:59.409998Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
2020-01-07T21:47:59.409999Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2020-01-07T21:47:59.410001Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2020-01-07T21:47:59.410003Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2020-01-07T21:47:59.410004Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2020-01-07T21:47:59.410006Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2020-01-07T21:47:59.410008Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2020-01-07T21:47:59.410009Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
2020-01-07T21:47:59.410011Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2020-01-07T21:47:59.410012Z 0 [Note] Shutting down plugin 'INNODB_CMP'
2020-01-07T21:47:59.410014Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2020-01-07T21:47:59.410016Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
2020-01-07T21:47:59.410017Z 0 [Note] Shutting down plugin 'INNODB_TRX'
2020-01-07T21:47:59.410019Z 0 [Note] Shutting down plugin 'InnoDB'
2020-01-07T21:47:59.410083Z 0 [Note] InnoDB: FTS optimize thread exiting.
2020-01-07T21:47:59.410230Z 0 [Note] InnoDB: Starting shutdown...
2020-01-07T21:47:59.511556Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
2020-01-07T21:47:59.511701Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 200107 21:47:59
2020-01-07T21:48:00.958542Z 0 [Note] InnoDB: Shutdown completed; log sequence number 2628246
2020-01-07T21:48:00.960660Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2020-01-07T21:48:00.960692Z 0 [Note] Shutting down plugin 'MEMORY'
2020-01-07T21:48:00.960697Z 0 [Note] Shutting down plugin 'CSV'
2020-01-07T21:48:00.960701Z 0 [Note] Shutting down plugin 'sha256_password'
2020-01-07T21:48:00.960703Z 0 [Note] Shutting down plugin 'mysql_native_password'
2020-01-07T21:48:00.960789Z 0 [Note] Shutting down plugin 'binlog'
2020-01-07T21:48:00.962661Z 0 [Note] mysqld: Shutdown complete

and this is the logfile after i run service mysql start :

2020-01-07T21:47:54.400816Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-01-07T21:47:55.708390Z 0 [Warning] InnoDB: New log files created, LSN=45790
2020-01-07T21:47:55.886509Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2020-01-07T21:47:56.038387Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 5d1f693e-3197-11ea-95e2-0242ac110002.
2020-01-07T21:47:56.040635Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2020-01-07T21:47:56.456659Z 0 [Warning] CA certificate ca.pem is self signed.
2020-01-07T21:47:56.740853Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2020-01-07T21:47:59.268086Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-01-07T21:47:59.269832Z 0 [Note] mysqld (mysqld 5.7.28) starting as process 334 ...
2020-01-07T21:47:59.274112Z 0 [Note] InnoDB: PUNCH HOLE support available
2020-01-07T21:47:59.274187Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-01-07T21:47:59.274191Z 0 [Note] InnoDB: Uses event mutexes
2020-01-07T21:47:59.274194Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2020-01-07T21:47:59.274196Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-01-07T21:47:59.274199Z 0 [Note] InnoDB: Using Linux native AIO
2020-01-07T21:47:59.274482Z 0 [Note] InnoDB: Number of pools: 1
2020-01-07T21:47:59.274639Z 0 [Note] InnoDB: Using CPU crc32 instructions
2020-01-07T21:47:59.276370Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2020-01-07T21:47:59.281119Z 0 [Note] InnoDB: Completed initialization of buffer pool
2020-01-07T21:47:59.282302Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2020-01-07T21:47:59.294898Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2020-01-07T21:47:59.301611Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2020-01-07T21:47:59.301665Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2020-01-07T21:47:59.344888Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2020-01-07T21:47:59.345338Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2020-01-07T21:47:59.345345Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2020-01-07T21:47:59.346096Z 0 [Note] InnoDB: Waiting for purge to start
2020-01-07T21:47:59.396626Z 0 [Note] InnoDB: 5.7.28 started; log sequence number 2628227
2020-01-07T21:47:59.396804Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2020-01-07T21:47:59.396852Z 0 [Note] Plugin 'FEDERATED' is disabled.
2020-01-07T21:47:59.397717Z 0 [Note] InnoDB: Buffer pool(s) load completed at 200107 21:47:59
2020-01-07T21:47:59.400400Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2020-01-07T21:47:59.400413Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2020-01-07T21:47:59.400770Z 0 [Warning] CA certificate ca.pem is self signed.
2020-01-07T21:47:59.400790Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2020-01-07T21:47:59.400992Z 0 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
2020-01-07T21:47:59.401006Z 0 [Note]   - '127.0.0.1' resolves to '127.0.0.1';
2020-01-07T21:47:59.401021Z 0 [Note] Server socket created on IP: '127.0.0.1'.
2020-01-07T21:47:59.403395Z 0 [Warning] Insecure configuration for --pid-file: Location '/tmp' in the path is accessible to all OS users. Consider choosing a different directory.
2020-01-07T21:47:59.408666Z 0 [Note] Event Scheduler: Loaded 0 events
2020-01-07T21:47:59.408808Z 0 [Note] Execution of init_file '/var/lib/mysql-files/7pxJ7t37bI' started.
2020-01-07T21:47:59.409234Z 0 [Note] Execution of init_file '/var/lib/mysql-files/7pxJ7t37bI' ended.
2020-01-07T21:47:59.409284Z 0 [Note] mysqld: ready for connections.
Version: '5.7.28'  socket: '/tmp/tmp.q7db4MMdAE/mysqld.sock'  port: 3306  MySQL Community Server (GPL)
2020-01-07T21:47:59.409594Z 0 [Note] Giving 0 client threads a chance to die gracefully
2020-01-07T21:47:59.409606Z 0 [Note] Shutting down slave threads
2020-01-07T21:47:59.409609Z 0 [Note] Forcefully disconnecting 0 remaining clients
2020-01-07T21:47:59.409612Z 0 [Note] Event Scheduler: Purging the queue. 0 events
2020-01-07T21:47:59.409663Z 0 [Note] Binlog end
2020-01-07T21:47:59.409938Z 0 [Note] Shutting down plugin 'ngram'
2020-01-07T21:47:59.409944Z 0 [Note] Shutting down plugin 'partition'
2020-01-07T21:47:59.409946Z 0 [Note] Shutting down plugin 'BLACKHOLE'
2020-01-07T21:47:59.409948Z 0 [Note] Shutting down plugin 'ARCHIVE'
2020-01-07T21:47:59.409950Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2020-01-07T21:47:59.409962Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
2020-01-07T21:47:59.409964Z 0 [Note] Shutting down plugin 'MyISAM'
2020-01-07T21:47:59.409969Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
2020-01-07T21:47:59.409971Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2020-01-07T21:47:59.409973Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2020-01-07T21:47:59.409975Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2020-01-07T21:47:59.409976Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2020-01-07T21:47:59.409978Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2020-01-07T21:47:59.409980Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2020-01-07T21:47:59.409981Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2020-01-07T21:47:59.409983Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2020-01-07T21:47:59.409985Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2020-01-07T21:47:59.409986Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2020-01-07T21:47:59.409988Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2020-01-07T21:47:59.409990Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2020-01-07T21:47:59.409991Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2020-01-07T21:47:59.409993Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2020-01-07T21:47:59.409995Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2020-01-07T21:47:59.409996Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
2020-01-07T21:47:59.409998Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
2020-01-07T21:47:59.409999Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2020-01-07T21:47:59.410001Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2020-01-07T21:47:59.410003Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2020-01-07T21:47:59.410004Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2020-01-07T21:47:59.410006Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2020-01-07T21:47:59.410008Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2020-01-07T21:47:59.410009Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
2020-01-07T21:47:59.410011Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2020-01-07T21:47:59.410012Z 0 [Note] Shutting down plugin 'INNODB_CMP'
2020-01-07T21:47:59.410014Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2020-01-07T21:47:59.410016Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
2020-01-07T21:47:59.410017Z 0 [Note] Shutting down plugin 'INNODB_TRX'
2020-01-07T21:47:59.410019Z 0 [Note] Shutting down plugin 'InnoDB'
2020-01-07T21:47:59.410083Z 0 [Note] InnoDB: FTS optimize thread exiting.
2020-01-07T21:47:59.410230Z 0 [Note] InnoDB: Starting shutdown...
2020-01-07T21:47:59.511556Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
2020-01-07T21:47:59.511701Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 200107 21:47:59
2020-01-07T21:48:00.958542Z 0 [Note] InnoDB: Shutdown completed; log sequence number 2628246
2020-01-07T21:48:00.960660Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2020-01-07T21:48:00.960692Z 0 [Note] Shutting down plugin 'MEMORY'
2020-01-07T21:48:00.960697Z 0 [Note] Shutting down plugin 'CSV'
2020-01-07T21:48:00.960701Z 0 [Note] Shutting down plugin 'sha256_password'
2020-01-07T21:48:00.960703Z 0 [Note] Shutting down plugin 'mysql_native_password'
2020-01-07T21:48:00.960789Z 0 [Note] Shutting down plugin 'binlog'
2020-01-07T21:48:00.962661Z 0 [Note] mysqld: Shutdown complete

2020-01-07T21:59:26.471325Z mysqld_safe Logging to '/var/log/mysql/error.log'.
2020-01-07T21:59:26.486959Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2020-01-07T21:59:26.643199Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-01-07T21:59:26.644096Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.28) starting as process 408 ...
2020-01-07T21:59:26.646176Z 0 [Note] InnoDB: PUNCH HOLE support available
2020-01-07T21:59:26.646190Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-01-07T21:59:26.646193Z 0 [Note] InnoDB: Uses event mutexes
2020-01-07T21:59:26.646196Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2020-01-07T21:59:26.646198Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-01-07T21:59:26.646201Z 0 [Note] InnoDB: Using Linux native AIO
2020-01-07T21:59:26.646331Z 0 [Note] InnoDB: Number of pools: 1
2020-01-07T21:59:26.646391Z 0 [Note] InnoDB: Using CPU crc32 instructions
2020-01-07T21:59:26.647165Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2020-01-07T21:59:26.651798Z 0 [Note] InnoDB: Completed initialization of buffer pool
2020-01-07T21:59:26.653130Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2020-01-07T21:59:27.636212Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2020-01-07T21:59:27.642182Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2020-01-07T21:59:27.642232Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2020-01-07T21:59:27.689063Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2020-01-07T21:59:27.689519Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2020-01-07T21:59:27.689527Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2020-01-07T21:59:27.689913Z 0 [Note] InnoDB: Waiting for purge to start
2020-01-07T21:59:27.740941Z 0 [Note] InnoDB: 5.7.28 started; log sequence number 2628246
2020-01-07T21:59:27.741098Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2020-01-07T21:59:27.741221Z 0 [Note] Plugin 'FEDERATED' is disabled.
2020-01-07T21:59:27.810722Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2020-01-07T21:59:27.810737Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2020-01-07T21:59:27.811201Z 0 [Warning] CA certificate ca.pem is self signed.
2020-01-07T21:59:27.811224Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2020-01-07T21:59:27.811663Z 0 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
2020-01-07T21:59:27.811680Z 0 [Note]   - '127.0.0.1' resolves to '127.0.0.1';
2020-01-07T21:59:27.811738Z 0 [Note] Server socket created on IP: '127.0.0.1'.
2020-01-07T21:59:27.813580Z 0 [Note] InnoDB: Buffer pool(s) load completed at 200107 21:59:27
2020-01-07T21:59:27.816611Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table storage engine for 'user' doesn't have this option
2020-01-07T21:59:27.816628Z 0 [ERROR] Fatal error: Failed to initialize ACL/grant/time zones structures or failed to remove temporary table files.
2020-01-07T21:59:27.816674Z 0 [ERROR] Aborting

2020-01-07T21:59:27.816694Z 0 [Note] Binlog end
2020-01-07T21:59:27.816756Z 0 [Note] Shutting down plugin 'ngram'
2020-01-07T21:59:27.816763Z 0 [Note] Shutting down plugin 'partition'
2020-01-07T21:59:27.816765Z 0 [Note] Shutting down plugin 'BLACKHOLE'
2020-01-07T21:59:27.816767Z 0 [Note] Shutting down plugin 'ARCHIVE'
2020-01-07T21:59:27.816769Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2020-01-07T21:59:27.816803Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
2020-01-07T21:59:27.816806Z 0 [Note] Shutting down plugin 'MyISAM'
2020-01-07T21:59:27.816811Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
2020-01-07T21:59:27.816814Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2020-01-07T21:59:27.816816Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2020-01-07T21:59:27.816817Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2020-01-07T21:59:27.816819Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2020-01-07T21:59:27.816821Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2020-01-07T21:59:27.816822Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2020-01-07T21:59:27.816824Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2020-01-07T21:59:27.816826Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2020-01-07T21:59:27.816828Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2020-01-07T21:59:27.816829Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2020-01-07T21:59:27.816831Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2020-01-07T21:59:27.816833Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2020-01-07T21:59:27.816834Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2020-01-07T21:59:27.816836Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2020-01-07T21:59:27.816838Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2020-01-07T21:59:27.816839Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
2020-01-07T21:59:27.816841Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
2020-01-07T21:59:27.816843Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2020-01-07T21:59:27.816844Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2020-01-07T21:59:27.816846Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2020-01-07T21:59:27.816848Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2020-01-07T21:59:27.816849Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2020-01-07T21:59:27.816851Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2020-01-07T21:59:27.816852Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
2020-01-07T21:59:27.816854Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2020-01-07T21:59:27.816856Z 0 [Note] Shutting down plugin 'INNODB_CMP'
2020-01-07T21:59:27.816857Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2020-01-07T21:59:27.816859Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
2020-01-07T21:59:27.816861Z 0 [Note] Shutting down plugin 'INNODB_TRX'
2020-01-07T21:59:27.816863Z 0 [Note] Shutting down plugin 'InnoDB'
2020-01-07T21:59:27.816936Z 0 [Note] InnoDB: FTS optimize thread exiting.
2020-01-07T21:59:27.817047Z 0 [Note] InnoDB: Starting shutdown...
2020-01-07T21:59:27.922074Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
2020-01-07T21:59:27.922231Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 200107 21:59:27
2020-01-07T21:59:29.468679Z 0 [Note] InnoDB: Shutdown completed; log sequence number 2628265
2020-01-07T21:59:29.470792Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2020-01-07T21:59:29.470822Z 0 [Note] Shutting down plugin 'MEMORY'
2020-01-07T21:59:29.470827Z 0 [Note] Shutting down plugin 'CSV'
2020-01-07T21:59:29.470830Z 0 [Note] Shutting down plugin 'sha256_password'
2020-01-07T21:59:29.470832Z 0 [Note] Shutting down plugin 'mysql_native_password'
2020-01-07T21:59:29.470919Z 0 [Note] Shutting down plugin 'binlog'
2020-01-07T21:59:29.471136Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

2020-01-07T21:59:29.582468Z mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

So any Idea why I am facing this problem or any hint that can lend me to the right way to do it.

After I did a little research I found the solution, I just need to run this following command :

chown -R mysql:mysql /var/lib/mysql /var/run/mysqld   // change the ownership of all files and subdirectories under the /var/lib/mysql and /var/run/mysqld

then I can start mysql with no problems

service mysql start

and now it works perfectly

..
[info] MySQL Community Server 5.7.28 is started.

or I can do it this way :

find /var/lib/mysql -type f -exec touch {} \;  //find every file in that directory and execute touch to touch all the files and change the files access.

or you can do it as @Petesh said:

RUN printf '%s\n' 'mysql-community-server mysql-community-server/root-pass password your_password' | debconf-set-selections && \
    printf '%s\n' 'mysql-community-server mysql-community-server/re-root-pass password your_password' | debconf-set-selections && \
    apt -y install mysql-server && \
    rm -rf /var/lib/mysql/*                          // remove all the files in this directory and when you will run `service mysql start` it'll recreate the database and mysql will start.

I really don't understand why I need to change the user and group of the files in that directories, maybe it's due the build way of the Dockerfile because it uses intermediate containers during the build.

because when I build the image debian:buster without Dockerfile and run the container then install the mysql-server manually and start it, it started perfectly.

correct me if I am wrong.

for more information mysql __ Chown Command __ github

When you create the docker image, it generates an initial database.

The problem is that the files in this location are then mounted on an overlay file system when you try running.

These files can't be used by mysql when it starts up because they're not modifiable in-place.

When you chown, it creates 'fresh' copies of the files, which allows mysql to start up as these files are now modifiable in-place.

If you want a container that can just launch a fresh mysql, the best workaround for this is to delete everything below /var/lib/mysql as part of the image creation step. It will recreate the database on first start, allowing it to be used as needed.

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