Mysql 数据库crash恢复
之前搭建的ghost博客比较坑,修改comment之后重启数据丢了,对node不熟悉,所以就切换回到wordpress了。
回滚快照之后发现数据库crash了,提示如下信息
2016-06-15 23:21:32 3344 [Note] InnoDB: Database was not shutdown normally!
2016-06-15 23:21:32 3344 [Note] InnoDB: Starting crash recovery.
2016-06-15 23:21:32 3344 [Note] InnoDB: Reading tablespace information from the .ibd files...
2016-06-15 23:21:32 3344 [ERROR] InnoDB: Attempted to open a previously opened tablespace. Previous tablespace sakila/cou
ntry uses space ID: 32 at filepath: ./sakila/country.ibd. Cannot open tablespace wordpress/wp_options which uses space ID
: 32 at filepath: ./wordpress/wp_options.ibd
2016-06-15 23:21:32 7f9868b4e780 InnoDB: Operating system error number 2 in a file operation.
InnoDB: The error means the system cannot find the path specified.
InnoDB: If you are installing InnoDB, remember that you must create
InnoDB: directories yourself, InnoDB does not create them.
InnoDB: Error: could not open single-table tablespace file ./wordpress/wp_options.ibd
InnoDB: We do not continue the crash recovery, because the table may become
InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it.
InnoDB: To fix the problem and start mysqld:
InnoDB: 1) If there is a permission problem in the file and mysqld cannot
InnoDB: open the file, you should modify the permissions.
InnoDB: 2) If the table is not needed, or you can restore it from a backup,
InnoDB: then you can remove the .ibd file, and InnoDB will do a normal
InnoDB: crash recovery and ignore that table.
InnoDB: 3) If the file system or the disk is broken, and you cannot remove
InnoDB: the .ibd file, you can set innodb_force_recovery > 0 in my.cnf
InnoDB: and force InnoDB to continue crash recovery here.
可能之前强制关机导致的,直接重转有点可惜。
根据错误提示限恢复下
1、在my.cnf中添加如下参数
在[mysqld]组中加入:
innodb_force_recovery=6
之后启动mysql
innodb_force_recovery影响整个InnoDB存储引擎的恢复状况,默认值为0,表示当需要恢复时执行所有的恢复操作。
当不能进行有效的恢复操作时,mysql有可能无法启动,并记录下错误日志。
innodb_force_recovery可以设置为1-6,大的数字包含前面所有数字的影响。
当设置参数值大于0后,可以对表进行select,create,drop操作,但insert,update或者delete这类操作是不允许的。
1(SRV_FORCE_IGNORE_CORRUPT):忽略检查到的corrupt页
2(SRV_FORCE_NO_BACKGROUND):阻止主线程的运行,如主线程需要执行full purge操作,会导致crash
3(SRV_FORCE_NO_TRX_UNDO):不执行事务回滚操作。
4(SRV_FORCE_NO_IBUF_MERGE):不执行插入缓冲的合并操作。
5(SRV_FORCE_NO_UNDO_LOG_SCAN):不查看重做日志,InnoDB存储引擎会将未提交的事务视为已提交。
6(SRV_FORCE_NO_LOG_REDO):不执行前滚的操作。
2、备份数据库
mysqldump wordpress >wp.sql
3、删除数据库物理文件(删除损坏部分)
4、重启数据库
5、导入备份的数据库文件
ps:发生了一件比较奇怪的情况,建立原来的数据库wordpress无法导入,提示已经存在,手动删除换是提示idb文件再次导入换是已经存在。
但是导入其他的数据库是正常的,所以干脆下修改配置文件里的数据库名,之后重新授权,大功告成
Mysql 数据库crash恢复的更多相关文章
- Xtrabackup原理及使用innobackupex进行MySQL数据库备份恢复
Xtrabackup是由percona提供的mysql数据库备份工具,据官方介绍,这也是世界上惟一一款开源的能够对innodb和xtradb数据库进行热备的工具. Xtrabackup中主要包含两个工 ...
- MySQL用户管理、常用sql语句、MySQL数据库备份恢复
1.MySQL用户管理 给远程登陆用户授权:grant all on *.* to 'user1'@'127.0.0.1' identified by '123456' (这里的127.0.0.1是指 ...
- Linux centosVMware mysql用户管理、常用sql语句、mysql数据库备份恢复
一.mysql用户管理 grant all on *.* to 'user1'@‘127.0.0.1’ identified by 'mimA123'; 创建user1用户 使用user1登录 /us ...
- postgresql 和 mysql 数据库备份恢复以及时区问题
概要 postgesql 12 备份/恢复脚本 时区设置 mysql 5.6 备份/恢复脚本 时区设置 概要 postgresql 和 mysql 是最常用的 2 种开源关系数据库, 很多项目也会优先 ...
- MySQL数据库迁移与MySQL数据库批量恢复
目录 一.MySQL数据库迁移或备份 1. 了解使用InnoDB引擎创建数据库所产生的文件 2. 迁移数据库步骤 1. 从A服务器迁移至B服务器 2. MySQL重装并导入之前数据库 二.MySQL数 ...
- MySQL Innodb数据库误删ibdata1后MySQL数据库的恢复案例
上周,以前公司的同事朋友找我帮忙,看看能否帮忙恢复一个MySQL 数据库,具体情况为:数据库版本为MySQL 5.6(具体版本不清楚),也不清楚具体的数据库引擎; 没有数据库备份,只剩下数据库下面 ...
- 生产环境mysql数据库主从恢复从数据库
故障:系统硬盘损坏,完全重装 故障机器:172.16.100.32 恢复根据的主机器:172.16.100.31 1. 重装完成后,把master主库vs/program目录拷贝过来,然后把数据库的d ...
- mysql数据库备份/恢复
备份数据库(进入Mysql bin目录下/C:\Program Files\MySQL\MySQL Server 5.6\bin)本地安装mysql数据库 备份表结构及数据 mysqldump -hl ...
- 使用xtrbackup 热备MySQL数据库 以及恢复和自动删除脚本
直接上脚本 热备(全备) #!/bin/bash user='root' passwd='123456' my_config='/etc/my.cnf' #mysql configure log=fu ...
随机推荐
- ArcGIS中QueryTask,FindTask,IndentifyTask 之间的区别
1:QueryTask是一个进行空间和属性查询的功能类,它可以在某个地图服务的某个子图层内进行查询,顺便需要提一下的是,QueryTask进行查询的地图服务并 不必项加载到Map中进行显示.Query ...
- bash字符串前导美元符号的作用
problem bash内置变量IFS作为内部单词分隔符,其默认值为<space><tab><newline>, 我想设置它仅为\n,于是: OLD_IFS=$IF ...
- Unity NGUI 粒子的排序
Unity NGUI系统中是没有对粒子进行排序的,如: 怎么解决这个问题呢? 思路是把粒子的渲染层级,相对于UI组件的层级进行一个偏移. 解决后的效果如下: 代码如下: using System.Co ...
- js获取table checkbox选中行的值.mdjs获取table checkbox选中行的
<!DOCTYPE html> <html> <head> <script src="https://cdn.staticfile.org/jque ...
- Spark RDD基本操作
- Hive中SQL查询转换成MapReduce作业的过程
- python 的打开、读、写、追加操作
读f = open('D:\最新全栈python第2期视频教程 全套完整版\day08-python 全栈开发-基础篇\新建文本文档.txt','r') # data = f.read(10000)# ...
- CI的session操作
在使用session之前,要对配置文件config.php 里面的$config['encryption_key']随便赋个值,例如1234 1. 首先要加载session类,固定写法:$this-& ...
- DELPHI实现类似仿360桌面的程序界面
1.窗体半透明: Alphablend属性为true;Alphablendvalue的值为100 2.窗体透明: formCreate: Self.TransparentColor := True;S ...
- python模块(转自Yuan先生)
模块&包(****) 模块(modue)的概念: 在计算机程序的开 ...