簡體   English   中英

Mysql 不會開始使用 Dockerfile

[英]Mysql won't start using Dockerfile

我正在嘗試使用 Dockerfile 以非交互方式(沒有被問到任何配置問題)安裝 mysql,並且我在以下內容中找到了如何執行此操作的解決方案: 如何在 Dockerfile 中使用此處的字符串?

但是現在當我嘗試使用容器內的service mysql start啟動 mysql 時,我面臨另一個問題它不起作用,我想知道為什么? 因為當我在 debian:buster 鏡像的容器中手動進行安裝時,它運行良好。

正如您在下面看到的那樣,它不會啟動:

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..

這是我的 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

這是使用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

這是我運行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

所以任何想法為什么我面臨這個問題或任何可以借給我正確方法的提示。

在我做了一些研究后,我找到了解決方案,我只需要運行以下命令:

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

然后我可以毫無問題地啟動mysql

service mysql start

現在它完美地工作

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

或者我可以這樣做:

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.

或者你可以像@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.

我真的不明白為什么我需要更改該目錄中文件的用戶和組,可能是由於 Dockerfile 的構建方式,因為它在構建過程中使用了中間容器。

因為當我在沒有 Dockerfile 的情況下構建圖像 debian:buster 並運行容器然后手動安裝 mysql-server 並啟動它時,它完美地啟動了。

如果我錯了,請糾正我。

有關更多信息mysql __ Chown 命令__ github

當您創建 docker 鏡像時,它會生成一個初始數據庫。

問題在於,當您嘗試運行時,此位置中的文件會掛載到覆蓋文件系統上。

mysql 在啟動時不能使用這些文件,因為它們不能就地修改。

當您 chown 時,它會創建文件的“新鮮”副本,這允許 mysql 啟動,因為這些文件現在可以就地修改。

如果您想要一個可以啟動新 mysql 的容器,最好的解決方法是刪除/var/lib/mysql作為映像創建步驟的一部分。 它將在第一次啟動時重新創建數據庫,以便根據需要使用它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM