To check, repair and optimise tables with MySQL
to check all tables in all databases;
mysqlcheck -c -u root -p --all-databases
to check all tables in a single database;
mysqlcheck -c my_db -u root -p
to check all tables in a few database;
mysqlcheck -c -u root -p --databases my_db my_other_db my_cool_db
to check a table in a single database;
mysqlcheck -c my_bd my_table -u root -p
Use the -a option in place of -c to analyse instead of checking.
Similarly, there is the -o option for optimise and -r option for repair.
The --auto-repair option can be used in conjunction with check and optimise as follows;
mysqlcheck -u root -p --auto-repair -c -o my_db
We can of course do all databases at once;
mysqlcheck -u root -p --auto-repair -c -o --all-databases
--debug-info makes things more verbose
No comments:
Post a Comment
Note: only a member of this blog may post a comment.