Repairing MySQL tables

This should be handled on a case by case basis, but if you are using the default MySQL table type of MyISAM (which is the default storage engine unless changed or specified differently) here are a few options:

The myisamchk utility can be run from a command line to check, repair, or optimize tables. It is normally run while the database is not running. For more information about myisamchk visit the MySQL website. Mysqlcheck is similar in function to myisamchk, but can be run while the database is running. For more information about
mysqlcheck visit the MySQL website.

If you login to the database, you can also run sql commands that might fix your problem. Examples:

mysql> optimize table your-tablename;
mysql> analyze table your-tablename;
mysql> repair table your-tablename;

For more information about table maintenance SQL visit the MySQL website. If you are getting MySQL error numbers and are not sure what they are from the command line you can use the perror utility to lookup errors. For more info on perror visit the MySQL website. Examples:

shell> perror 13 64
Error code 13: Permission denied
Error code 64: Machine is not on the network

  • 789 Uživatelům pomohlo
Byla tato odpověď nápomocná?

Související články

MySQL Optimization / Repair Information

How MySQL Uses MemoryThis page lists some of the ways that the mysqld server uses memory, and...

How can I monitor what my MySQL server is doing?

A handy little Linux application called Mytop fits this just perfectly. This is a near time...

How do I backup a MySQL database?

By logging into cPanel >> Backups you can download and restore any individual MySQL...

How to reset a mySQL password?

If you have lost your root user password for MySQL, you can reset it with the following...

Securing MySQL

Due to differing needs and requirements this is difficult to answer except on a case by case...