Repairing MySQL tables that will not open

Repairing MySQL tables that will not open

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:

  1. The myisamchk utility can be run from a command line to checks, repairs, or optimizes tables. It is normally run while the database is not running. For more information about myisamchk visit the MySQL website.
  2. 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.
  3. 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.
  4. If you are getting MySQL error numbers and are not sure what they are. From a 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
    • Related Articles

    • Securing MySQL

      Due to differing needs and requirements this is difficult to answer except on a case by case basis. The MySQL website has a section regarding general security of a MySQL database available here: http://dev.mysql.com/doc/refman/5.0/en/security.html ...
    • How to reset a mySQL password?

      If you have lost your root user password for MySQL, you can reset it with the following procedure: Take down the mysqld server by sending a kill (not kill -9) to the mysqld server. The pid is stored in a .pid file, which is normally in the MySQL ...
    • MySQL Optimization / Repair Information

      How MySQL Uses Memory This page lists some of the ways that the mysqld server uses memory, and associated mysqld variable names Memory Use MySQL 5.0 Memory Use MySQL 4.1 MySQL Optimization which covers: - Optimization Overview - Optimizing SELECT and ...
    • How to install Mysql

      How to install Mysql Via RPM : Please check the following link and get RPM http://httpupdate.cpanel.net/mysqlinstall/ in above list (not rpm) click on the version for which you want to install mysql than click on the operation system than on the ...
    • Mysql Basic Commands

      [mysql dir]/bin/mysql -h hostname -u root -p Create a database on the sql server. create database [databasename]; List all databases on the sql server. show databases; Switch to a database. use [db name]; To see all the tables in the db. show tables; ...