问题描述
- 由于误操作,将mysql的mysql库删除,导致数据库启动异常,mysql启动报错,报错如下
2018-10-11 16:30:11 2995 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
181011 16:30:11 mysqld_safe mysqld from pid file /export/servers/data/mysql/3306/pid/mysql.pid ended
解决方法
- 从别的环境拷贝 user.frm user.MYD user.MYI 这三个文件
cd /export/servers/data/mysql/3306/data/mysql/
ls user.*
user.frm user.MYD user.MYI
- 拷贝到报错的环境
- 更改权限
cd /export/servers/data/mysql/3306/data/mysql/
chmod admin.admin user.*
chmod 775 user.*
再次启动即可