MySQL错误修复:Table crashed repair
2020-11-24 09:58
671 查看
问题一 Table xx is marked as crashed and last (automatic?) repair failed
有开发找到我,说数据库坏了,连不上数据库,看了下 MySQL 的错误日志,报错如下:
Error: Table './db_name/table_name' is marked as crashed and last (automatic?) repair failed
修复
1、先停止 MySQL:service mysqld stop
2、进入到 MySQL 数据库的文件存放目录,比如 cd /data/mysql_data/xx_db
然后执行如下命令:
myisamchk --safe-recover -f -r *.MYI
执行完成后,为了保险起见,我们要将文件的权限改回 MySQL 的运行账号(自行查看),比如 mysql:
chown -R mysql:mysql .
3、启动 MySQL:service mysqld start
4、最后,执行再次自动修复优化命令即可解决:
mysqlcheck --auto-repair --optimize --all-databases -p密码
问题二 /usr/local/mysql/bin/mysqld does not exist or is not executable.
]# /data/wapage/hhzk/mserver/mysql5713/bin/mysqld_safe --defaults-file=/etc/my.cnf & [1] 24527 ]# 2020-11-23T10:36:45.803151Z mysqld_safe Logging to '/data/wapage/hhzk/mserver/mysql5713/data/qd01-tech2-rec-build001.ps.easou.com.err'. 2020-11-23T10:36:45.809116Z mysqld_safe The file /usr/local/mysql/bin/mysqld does not exist or is not executable. Please cd to the mysql installation directory and restart this script from there as follows: ./bin/mysqld_safe& See http://dev.mysql.com/doc/mysql/en/mysqld-safe.html for more information [1]+ Exit 1 /data/wapage/hhzk/mserver/mysql5713/bin/mysqld_safe --defaults-file=/etc/my.cnf
说明:mysqld_safe启动脚本默认的从/usr/local/mysql目录中读取另外一个启动脚本mysqld,因为我的安装目录为/data/wapage/hhzk/mserver/mysql5713。所以找不到相关文件。可以从两个方面解决。
方法一:在/usr/local/mysql创建链接文件
mkdir -p /usr/local/mysql/bin ln -s /data/wapage/hhzk/mserver/mysql5713/bin/mysqld /usr/local/mysql/bin/mysqld
方法二:将mysqld_safe中的所有/usr/local/mysql目录改为自己实际的安装目录
sed -i 's#/usr/local/mysql#/data/wapage/hhzk/mserver/mysql5713#g' /data/wapage/hhzk/mserver/mysql5713/bin/mysqld_safe
相关文章推荐
- 检查和修复mysql表:mysql table is marked as crashed and last (automatic?) repair failed
- mysql错误:Table XXX is marked as crashed and should be repaire
- mysql: "tablename" is marked as crashed and should be repaired修复 问题分析: 当mysql出现这类提示时,大部分的现象为查询不到正常的
- mysql错误:Table XXX is marked as crashed and should be repaire
- Mysql错误:Table 'xxx'is marked as crashed and last (automatic) repair failed
- mysql错误:Table XXX is marked as crashed and should be repaired
- mysql table is marked as crashed and last (automatic?) repair failed
- 修复数据表(mysql repair table-Can’t open file: ‘[Table]mytable.MYI’.)
- 修复数据表(mysql repair table-Can’t open file: ‘[Table]mytable.MYI’.)
- mysql错误:Table XXX is marked as crashed and should be repaired
- mysql之repair table 修复表札记
- MySql Table错误:is marked as crashed and last (automatic?) 和 Error: Table "mysql"."innodb_table_stats" not found
- Table 'this_' is marked as crashed and should be repaired (MYSQL数据错误解决)
- mysql之repair table 修复表札记
- mysql错误:Table XXX is marked as crashed and should be repaired
- Mysql Table './tablename' is marked as crashed and last (automatic?) repair failed 错误解决办法
- MySQL 错误Incorrect key file for table ******.MYI; try to repair it的解决
- Mysql错误:Table 'xxx'is marked as crashed and should be repaired
- mysql之repair table 修复表札记
- mysql table is marked as crashed and last (automatic?) repair failed