在服务器上的空间耗尽后,似乎Docker Mysql的文件被损坏了。 尝试重新启动mysql:5.6容器时,我会得到错误[错误]致命错误:无法打开并锁定

问题描述 投票:0回答:4
mysql:5.6

容器时,我会出现错误。 我无法找到已损坏的文件,并可能将其删除或修复权限。

here是一个完整的错误输出:

[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
	
需要删除断开的连接,然后再次启动容器。

我有同样的问题,就我而言,这是因为我在运行cmd“ docker-compose up up”之前创建了db dir,在我删除image和删除我创建的db dir之后,它将确定 下面是我的docker.yml

volumes: - “./db:/var/lib/mysql"

我们应该注意到,在朗姆酒cmd之前不要创建db dir。
    
mysql docker
4个回答
5
投票
这个问题困扰着我很长时间,最后通过删除卷,然后再次纠正:


4
投票

为版本>8.3


0
投票
$ 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

在这种情况下,您可能需要降级为8.3版并使用此enter image description herelatest身份验证。 您可能需要运行

--default-authentication-plugin=mysql_native_password

0
投票
mysql_native_password

才能降级和重新升级docker rm mysql

本期

提供了更多信息。

版本8.4
版本
您可能需要添加此命令

docker compose rm mysql

并删除
docker compose up

为9+
版本

version 9删除了此选项,如发行说明中提到的那样。

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.