2

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 the database from this process? --skip-database=DATABASE_NAME seems don't work

2 Answers2

1

You can't skip data base but you can specify specific database for optimization.

mysqlcheck --user=root --password=PASSWORD_FOR_ROOT --auto-repair --optimize ----all-in-1 dbname

Where dbname is the name of database.

Ammad
  • 4,031
  • 12
  • 39
  • 62
0

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.