Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Skip a Database in mysqlcheck for Analyzing, Rebuilding, and Optimizing InnoDB Tables

There's a command to optimize and repair all databases:

mysqlcheck --user=root --password=PASSWORD_FOR_ROOT --auto-repair --optimize --all-databases

How can I skip a single, specific database from this process, while optimizing and repairing the other databases? --skip-database=DATABASE_NAME seems like it doesn't work.

like image 334
Stas Ponomaryov Avatar asked Dec 31 '25 06:12

Stas Ponomaryov


1 Answers

With mysql 8.0, you can skip one database with --skip-database=<db_name>; for instance:

mysqlcheck --user=root --password=PASSWORD_FOR_ROOT --optimize --all-databases --skip-database=<db_name>

However, <db_name> is ignored if it is mysql, at least on Ubuntu with mysql-server 8.0.32-0ubuntu0.22.10.2. But this issue has been fixed with mysql 8.0.33-0ubuntu0.22.10.1.

like image 76
jean-christophe manciot Avatar answered Jan 01 '26 23:01

jean-christophe manciot



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!