Can’t open and lock privilege tables: Incorrect file format ‘db’
ubuntu 16.04 LTS,mysql 5.7.23
sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf,在[mysql]行后增加 skip-grant-tables,让mysql服务在启动的时候不检查表的权限
启动服务后,mysql -uroot -p
mysql> use mysql;
mysql> repair db use_frm;
+----------+--------+----------+----------+
| Table | Op | Msg_type | Msg_text |
+----------+--------+----------+----------+
| mysql.db | repair | status | OK |
+----------+--------+----------+----------+
1 row in set (0.00 sec)
mysql> exit
修复mysql.db表后,编辑/etc/mysql/mysql.conf.d/mysqld.cnf文件,把skip-grant-tables行注释掉,重启mysql服务
update-alternatives: error: alternative path /etc/mysql/my.cnf.fallback doesn't exist
dpkg: error processing package mysql-common (--configure):
subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of mysql-client-5.7:
mysql-client-5.7 depends on mysql-common (>= 5.5); however:
Package mysql-common is not configured yet.
dpkg: error processing package mysql-client-5.7 (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
mysql-common
mysql-client-5.7
$ sudo mkdir -p /etc/mysql/my.cnf.fallback
$ sudo chown mysql.mysql /etc/mysql
$ sudo apt instal mysql-common mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 49 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up mysql-server-5.7 (5.7.24-0ubuntu0.16.04.1) ...
update-alternatives: error: alternative path /etc/mysql/mysql.cnf doesn't exist
dpkg: error processing package mysql-server-5.7 (--configure):
subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.7; however:
Package mysql-server-5.7 is not configured yet.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
mysql-server-5.7
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
$ sudo apt-get remove --purge mysql-\*
$ sudo apt-get install mysql-server mysql-client
ref: https://blog.csdn.net/qingchuwudi/article/details/52593501