You are here: mysql » fix crashed table on mysql
Fix crashed table on mysql
- Written By
- PHPin24
- Submitted At
- 2009-07-22 11:25:21
- Num Views
- 765
- Category
- MySQL
|
A crashed table indicates that the indexes of the table is corrupt. This generally happens in big tables. (exceeding 1 million records) Sometimes when the server crashes these indexes break. Points for prevention: * Proper coding style * Prevent server overheating * Disk space sufficient Things to look at: * Ensure that the MySQL version you are running is a stable version * Ensure your MySQL version is the recommended one by the Linux Distro. In the following example I am fixing a table called clienttable in a database called mydatabase To fix the table shut down your mysql server, generally the command is /etc/init.d/mysqld stop Then find the location where your mysql database files are stored and should give you all the files for you MyISAM tables locate MYI Change to the folder typically "/var/lib/mysql" cd /var/lib/mysql Go to the folder in the database that contains the crashed table in this case the db is called mydatabase cd mydatabase The run the following on the clienttable.MYI file myisamchk -r clienttable.MYI If you want to rebuild the indexes for all the tables you can run myisamchk -r *.MYI from within the folder of the database By PHPin24 @ 2009-07-22 11:25:21
|
