eHow launches Android app: Get the best of eHow on the go.

How To

How to Rebuild Indexes on MYSQL

Contributor
By Jeffrey Ober
eHow Contributing Writer
(0 Ratings)

When a system error happens to a mySql database, or when a table simple receives a large amount of incorrectly formatted data, the table indexes may become corrupt. The mySql system will inform a user that the table needs to be repaired when a CHECK TABLE command is run on the table. The command to verify the table needs repairing looks like this: CHECK TABLE tablename FOR UPGRADE. If the mySql system responds with "Table upgrade required," then the table needs the indexes rebuilt.

Difficulty: Challenging
Instructions
  1. Step 1

    Using telnet, ssh, or a local machine, connect to the mySql server and log into the mySql command-line tool. This can be done with mysql -p.

  2. Step 2

    Use the CHECK TABLE tablename FOR UPGRADE command to verify the table needs to be repaired.

  3. Step 3

    Exit the mysql command-line tool by typing x and pressing the "Enter" key. You will return to the shell command prompt.

  4. Step 4

    Dump the table with the mysqldump command: mysqldump databaseName tableName > dump.sql.

  5. Step 5

    Re-create the table in the database with the mysql command: mysql databaseName < dump.sql. This will rebuild the table and the table indexes.

Subscribe

Post a Comment

Post a Comment

Related Ads

  • Have you done this? Click here to let us know.
I Did This
Get Free Computers Newsletters

Copyright © 1999-2009 eHow, Inc. Use of this web site constitutes acceptance of the eHow Terms of Use and Privacy Policy .   en-US Portions of this page are modifications based on work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License. † requires javascript

eHow Computers
eHow_eHow Technology and Electronics