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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With