Search

User login

Poll

What is your favorite DB Server ?:
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
1 + 1 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.

My YM

Author Information

sentono
Offline
Last seen: 2 days 14 hours ago
Joined: 09/21/2007

Alexa Rank

Who's online

There are currently 0 users and 14 guests online.
Home
  • warning: Invalid argument supplied for foreach() in /usr/home/wowtutorial/public_html/sites/all/modules/adsense_injector/adsense_injector.module on line 352.
  • warning: Invalid argument supplied for foreach() in /usr/home/wowtutorial/public_html/sites/all/modules/adsense_injector/adsense_injector.module on line 35.

Repair Damage or Corrupted Table in MySQL

Here few standard MySQL command How To Repair Database Table in MySQL :

There are 2 method how to repair database in MySQL
First, we can just login into MySQL server and repair table there
Second, we can use MyISAMCHK to repair the table.

Login as root into your server

First Method is repair table from mysql console

[code]$mysql -u root -p
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 32686 to server version: 5.0.27-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>use testing;
mysql>mysql> repair table reviews;
+-----------------+--------+----------+----------+
| Table | Op | Msg_type | Msg_text |
+-----------------+--------+----------+----------+
| neohost.reviews | repair | status | OK |
+-----------------+--------+----------+----------+
1 row in set (0.00 sec)

mysql>[/code]

Second method is using MyISAMCHK to repair table.

IMPORTANT : IMPORTANT : IMPORTANT
We need to shutdown MySQL server first before we start repair table using MyISAMCHK.

First all we need to do is shutdown MySQL server Gracefully
[code]$/usr/local/mysql/bin/mysqladmin -u -p shutdown[/code]

Next, We will repair table using MyISAMCHK in "testing" DB
[code]$cd /var/lib/mysql/testing
$myisamchk -r cpg135_albums.MYI
- recovering (with sort) MyISAM-table 'cpg135_albums.MYI'
Data records: 3
- Fixing index 1
- Fixing index 2[/code]

We can also repair all tables in "testing" DB.
[code]$myisamchk -r *.MYI[/code]

 

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.

Recent comments

Facebook Fans

Sponsors

Online Store

Tag Cloud