Re: MySQL 4.0 (sarge) --> MySQL 5.0 (etch) -- Please do "REPAIR TABLE"
On 6/7/07, Jarek Buczyński <firstname.lastname@example.org> wrote:
> I suposse you will need to do inside the mysql client console:
> mysql> USE <database>;
> mysql> REPAIR TABLE <table>;
> ... and so on...
Thanks for replay. I understand if I would have one or two databases, but I
have o lot of databases with a lot of tables it is impossible do this in way
Anybody have any idea?
It's fairly easy to do with some basic shell scripting.
The following gets you the list of all your databases in a file called
mysql -u root -p <<eof | sed -n '2~1p' > all-databases
Then edit all-databases to remove any databases you don't want to mess
with (information_schema comes to mind).
Next use something similar to get lists of all tables in those
databases into different files (tables.db1, tables.db2, etc.).
Finally, iterate over the tables in these files and generate
appropriate repair table statements. These steps left as an exercise
for the reader.
You may want to brush up your shell-fu. The Advanced Bash Scripting
Guide (http://tldp.org/LDP/abs/html/) should help.