Home Database Mysql Tutorial 快速修复损坏的MySQL数据库

快速修复损坏的MySQL数据库

Jun 07, 2016 pm 06:04 PM
mysql repair database

在长时间使用 MySQL 后,数据库可能会出现一些问题。大多数问题可以通过简单的操作进行快速修复。下面介绍两种快速检修 MySQL 数据库的方法。

1、myisamchk
使用 myisamchk 必须暂时停止 MySQL 服务器。例如,我们要检修 discuz 数据库。执行以下操作:
# service mysql stop (停止 MySQL );
# myisamchk -r /数据库文件的绝对路径/*MYI
# service mysql start
myisamchk 会自动检查并修复数据表中的索引错误。
2、mysqlcheck
使用 mysqlcheck 无需停止 MySQL ,可以进行热修复。操作步骤如下:
# mysqlcheck -r discuz.*

# service mysql stop (停止 MySQL );
# myisamchk -r /数据库文件的绝对路径/*MYI
# service mysql start
myisamchk 会自动检查并修复数据表中的索引错误。

注意,无论是 myisamchk 还是 mysqlcheck ,一般情况下不要使用 -f 强制修复,-f 参数会在遇到一般修复无法成功的时候删除部分出错数据以尝试修复。所以,不到万不得已不要使用 -f。

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

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

This Apple ID is not yet in use in the iTunes Store: Fix This Apple ID is not yet in use in the iTunes Store: Fix Jun 10, 2024 pm 05:42 PM

This Apple ID is not yet in use in the iTunes Store: Fix

How to optimize MySQL query performance in PHP? How to optimize MySQL query performance in PHP? Jun 03, 2024 pm 08:11 PM

How to optimize MySQL query performance in PHP?

How to use MySQL backup and restore in PHP? How to use MySQL backup and restore in PHP? Jun 03, 2024 pm 12:19 PM

How to use MySQL backup and restore in PHP?

iPhone stuck in airplane mode: How to fix it iPhone stuck in airplane mode: How to fix it Jun 15, 2024 pm 02:16 PM

iPhone stuck in airplane mode: How to fix it

How to insert data into a MySQL table using PHP? How to insert data into a MySQL table using PHP? Jun 02, 2024 pm 02:26 PM

How to insert data into a MySQL table using PHP?

How to fix mysql_native_password not loaded errors on MySQL 8.4 How to fix mysql_native_password not loaded errors on MySQL 8.4 Dec 09, 2024 am 11:42 AM

How to fix mysql_native_password not loaded errors on MySQL 8.4

How to use MySQL stored procedures in PHP? How to use MySQL stored procedures in PHP? Jun 02, 2024 pm 02:13 PM

How to use MySQL stored procedures in PHP?

How to create a MySQL table using PHP? How to create a MySQL table using PHP? Jun 04, 2024 pm 01:57 PM

How to create a MySQL table using PHP?

See all articles