Can’t open and lock privilege tables | MariaDB 救援与排错

/ 0评 / 0

近来发现开发机上的 MariaDB 似乎挂了。幸亏不是在生产机上挂数据库。

具体的表现是:无法启动,启动时报错如下:

[ERROR] Could not open mysql.plugin table. Some plugins may be not loaded
[ERROR] Can't open and lock privilege tables: Table 'mysql.servers' doesn't exist
[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.db' doesn't exist
[ERROR] Aborting

这就很刺激了。mysql 库没了。

那么只能重新安装数据库了:

# mysql_install_db --user=mysql
# mysql_secure_install

mysql 库丢失也会顺带拉着插件表、用户表和用户权限表一并丢失。不过数据库本身(如果不是删库操作的话)并不会丢失。在完成 mysql 库的恢复后,重新添加用户并授予相应的权限就可以了。

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

Your comments will be submitted to a human moderator and will only be shown publicly after approval. The moderator reserves the full right to not approve any comment without reason. Please be civil.