Learning Mysql



Download 4.24 Mb.
View original pdf
Page336/366
Date04.08.2023
Size4.24 Mb.
#61806
1   ...   332   333   334   335   336   337   338   339   ...   366
Learning MySQL
366 | Chapter 10:
Backups and Recovery

mysql> REPAIR TABLE music.artist;
+--------------+--------+----------+----------+
| Table | Op | Msg_type | Msg_text |
+--------------+--------+----------+----------+
| music.artist | repair | status | OK |
+--------------+--------+----------+----------+
1 row inset sec)
If the music database was previously selected with the USE music command, you can write artist instead of music.artist
The mysqlcheck and mysqlisamchk programs allow you to check and repair tables from the command line.
mysqlcheck
mysqlcheck allows you to check and repair tables from the command line. In practice,
the most important options you’ll need are:
all-databases
Performs operation on all tables in all databases on the server.
repair
Tries to repair any corrupted tables.
extended
Tries harder to repair any corrupted tables (slower than just repair
).
For example, to check and repair all tables in the music database, you would write mysqlcheck --user=root --password=the_mysql_root_password -repair music
music.album OK
music.artist warning : Number of rows changed from 1 to status : OK
music.played OK
music.track OK
To check and attempt to repair all databases on the server, you would write mysqlcheck --user=root --password=the_mysql_root_password -extended --all-databases
myisamchk
This tool operates directly on the MyISAM database files, and so does not require the server to be shutdown. However, you need to ensure that the server is not using the tables while you’re trying to repair them if you can’t stop queries to the server, it’s probably a good idea to shutdown the server before using myisamchk
To use this utility, you need to specify the table or index file you want to check or repair.
For example, to check the artist table in the music database, give the path to the
artist.MYI file:

Download 4.24 Mb.

Share with your friends:
1   ...   332   333   334   335   336   337   338   339   ...   366




The database is protected by copyright ©ininet.org 2024
send message

    Main page