Home > Database > Mysql Tutorial > body text

mysql运行出现Can’t open and lock privilege tables: Inc

WBOY
Release: 2016-06-07 16:33:16
Original
1764 people have browsed it

一个安装lenny-debian系统的小设备,手快升级mysql后再启动mysql出现 120101 15:14:21 InnoDB: Started; log sequence number 0 73553120101 15:14:21 [Note] Recovering after a crash using /var/log/mysql/mysql-bin120101 15:14:21 [Note] Starting cras

一个安装lenny-debian系统的小设备,手快升级mysql后再启动mysql出现

120101 15:14:21  InnoDB: Started; log sequence number 0 73553
120101 15:14:21 [Note] Recovering after a crash using /var/log/mysql/mysql-bin
120101 15:14:21 [Note] Starting crash recovery...
120101 15:14:21 [Note] Crash recovery finished.
120101 15:14:21 [ERROR] Fatal error: Can't open and lock privilege tables: Incorrect file format 'host'
总是启动不了,google了一下,试验后发现使用下方法可以正常修复
step 1.使用 mysqld --skip-grant 命令启动mysql
step 2.使用 mysqldump 将库数据导出
step 3.使用 mysqladmin shutdown 停止mysqld 服务
step 4.在shell 下进入mysql数据目录,删除下面的 mysql 库
step 5.运行 mysql_install_db 重新创建默认的 mysql 库
step 6.运行mysqld服务,检查导入库数据,重新创建库用户、密码以及设置权限
step 7.执行cat /etc/mysql/debian.cnf 查看 debian-sys-maint帐号密码,运行mysql执行如下命令添加帐号
mysql> GRANT ALL PRIVILEGES ON *.*  TO 'debian-sys-maint'@'localhost' IDENTIFIED BY?'前面看到的密码' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;
如果已有debian-sys-maint帐号,可以使用如下命令修改密码为前面看到的
mysql>SET PASSWORD FOR 'debian-sys-maint'@'localhost' = PASSWORD('前面看到的密码');
mysql> FLUSH PRIVILEGES;
(如没有重要数据,可以忽略步骤1,2,3)
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template