简体   繁体   English

Mysql 不会开始使用 Dockerfile

[英]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?我正在尝试使用 Dockerfile 以非交互方式(没有被问到任何配置问题)安装 mysql,并且我在以下内容中找到了如何执行此操作的解决方案: 如何在 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?但是现在当我尝试使用容器内的service mysql start启动 mysql 时,我面临另一个问题它不起作用,我想知道为什么? because it was working perfectly when I was doing the installation manually inside the container of debian:buster image.因为当我在 debian:buster 镜像的容器中手动进行安装时,它运行良好。

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:这是我的 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这是使用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 :这是我运行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然后我可以毫无问题地启动mysql

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:或者你可以像@Petesh 所说的那样做:

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.我真的不明白为什么我需要更改该目录中文件的用户和组,可能是由于 Dockerfile 的构建方式,因为它在构建过程中使用了中间容器。

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.因为当我在没有 Dockerfile 的情况下构建图像 debian:buster 并运行容器然后手动安装 mysql-server 并启动它时,它完美地启动了。

correct me if I am wrong.如果我错了,请纠正我。

for more information mysql __ Chown Command __ github有关更多信息mysql __ Chown 命令__ github

When you create the docker image, it generates an initial database.当您创建 docker 镜像时,它会生成一个初始数据库。

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. mysql 在启动时不能使用这些文件,因为它们不能就地修改。

When you chown, it creates 'fresh' copies of the files, which allows mysql to start up as these files are now modifiable in-place.当您 chown 时,它会创建文件的“新鲜”副本,这允许 mysql 启动,因为这些文件现在可以就地修改。

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.如果您想要一个可以启动新 mysql 的容器,最好的解决方法是删除/var/lib/mysql作为映像创建步骤的一部分。 It will recreate the database on first start, allowing it to be used as needed.它将在第一次启动时重新创建数据库,以便根据需要使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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