Docker 中 MySql 启动失败,报错 Can't open and lock privilege tables: Table storage engine for 'user'

时间:2022-09-20 08:39:49

  我在docker容器中安装了Mysql,能运行,当我将它commit为新镜像后,运行新容器MySql无法运行。查看日志报错为:

Can't open and lock privilege tables: Table storage engine for 'user'

  将datadir路径下的文件清空,然后执行如下命令:mysqld --initialize --user=mysql --basedir=/usr --datadir=/var/lib/mysql

  然后重启:service mysql start  

  MySql启动成功。