[ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: 'user' (errno: 2 - No such file or directory)

报错信息:

2021-06-16T03:32:40.954339Z 0 [ERROR] Fatal error: Cant open and lock privilege tables: Cant find file: user (errno: 2 - No such file or directory)
2021-06-16T03:32:40.955117Z 0 [ERROR] Fatal error: Failed to initialize ACL/grant/time zones structures or failed to remove temporary table files.
2021-06-16T03:32:40.956219Z 0 [ERROR] Aborting
2021-06-16T03:32:40.936371Z 0 [ERROR] Cant open the mysql.plugin table. Please run mysql_upgrade to create it.

原因

因为是mysql data数据目录是直接拷贝,造成data/mysql 里面的配置文件和用户数据不一致导致的

解决方法

1、旧的data目录备份
2、初始化数据库,mysqld --initialize
3、拷贝初始化后的data/mysql到旧的data目录
4、将原来的data删除,然后旧的data目录修改为data目录
5、重启mysql命令

 

[ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: 'user' (errno: 2 - No such file or directory)

上一篇:参数化


下一篇:ThreadLocal