簡體   English   中英

無法重新啟動 MySQL Docker 容器,出現“無法打開 mysql.plugin 表”和“表 'mysql.user' 不存在”等錯誤

[英]Cannot restart the MySQL Docker container, gives errors like `Can't open the mysql.plugin table` and `Table 'mysql.user' doesn't exist`

服務器空間不足后,Docker MySQL 的文件似乎已損壞。

嘗試重新啟動mysql:5.6容器時,出現錯誤[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist

我找不到損壞的文件,可能無法將其刪除或修復權限。

這是一個完整的錯誤輸出:

$ docker start -a  mysql_1
2016-11-23 10:22:17 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-11-23 10:22:17 0 [Note] mysqld (mysqld 5.6.34) starting as process 1 ...
2016-11-23 10:22:17 1 [Note] Plugin 'FEDERATED' is disabled.
mysqld: Table 'mysql.plugin' doesn't exist
2016-11-23 10:22:17 1 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2016-11-23 10:22:17 1 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-11-23 10:22:17 1 [Note] InnoDB: The InnoDB memory heap is disabled
2016-11-23 10:22:17 1 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-11-23 10:22:17 1 [Note] InnoDB: Memory barrier is not used
2016-11-23 10:22:17 1 [Note] InnoDB: Compressed tables use zlib 1.2.8
2016-11-23 10:22:17 1 [Note] InnoDB: Using Linux native AIO
2016-11-23 10:22:17 1 [Note] InnoDB: Using CPU crc32 instructions
2016-11-23 10:22:17 1 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-11-23 10:22:17 1 [Note] InnoDB: Completed initialization of buffer pool
2016-11-23 10:22:17 1 [Note] InnoDB: Highest supported file format is Barracuda.
2016-11-23 10:22:17 1 [Note] InnoDB: Log scan progressed past the checkpoint lsn 49463
2016-11-23 10:22:17 1 [Note] InnoDB: Database was not shutdown normally!
2016-11-23 10:22:17 1 [Note] InnoDB: Starting crash recovery.
2016-11-23 10:22:17 1 [Note] InnoDB: Reading tablespace information from the .ibd files...
2016-11-23 10:22:17 1 [Note] InnoDB: Restoring possible half-written data pages
2016-11-23 10:22:17 1 [Note] InnoDB: from the doublewrite buffer...
InnoDB: Doing recovery: scanned up to log sequence number 1600607
2016-11-23 10:22:17 1 [Note] InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percent: 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
InnoDB: Apply batch completed
2016-11-23 10:22:18 1 [Note] InnoDB: 128 rollback segment(s) are active.
2016-11-23 10:22:18 1 [Note] InnoDB: Waiting for purge to start
2016-11-23 10:22:18 1 [Note] InnoDB: 5.6.34 started; log sequence number 1600607
2016-11-23 10:22:18 1 [Note] Server hostname (bind-address): '*'; port: 3306
2016-11-23 10:22:18 1 [Note] IPv6 is available.
2016-11-23 10:22:18 1 [Note]   - '::' resolves to '::';
2016-11-23 10:22:18 1 [Note] Server socket created on IP: '::'.
2016-11-23 10:22:18 1 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist

因此需要docker-compose rm mysql刪除斷開的連接,然后再次啟動容器。

我遇到了同樣的問題,就我而言,這是因為我在運行 cmd 'docker-compose up' 之前已經為卷創建了 db dir,在我刪除圖像並刪除我創建的 db dir 之后,下面是我的 docker .yml

卷:-“./db:/var/lib/mysql”

我們應該注意不要在 rum cmd 之前創建 db 目錄。

暫無
暫無

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

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