0

I'm using the mysqlcheck command for an automated script. I want to give, the user running the script, the minimum permissions required to be able to successfully run the command with the --all-databases and --repair arguments.

Ryan
  • 269
  • 1
  • 3
  • 15

1 Answers1

0

A quick excerpt from the documentation page of mysqlcheck:

mysqlcheck uses the SQL statements CHECK TABLE, REPAIR TABLE, ANALYZE TABLE, and OPTIMIZE TABLE in a convenient way for the user.

The documentation page of CHECK TABLE specifies:

To check a table, you must have some privilege for it.

The documentation pages of REPAIR TABLE, ANALYZE TABLE, and OPTIMIZE TABLE specify:

This statement requires SELECT and INSERT privileges for the table.

I think the conclusion is obvious: grant the user only the SELECT and INSERT global privileges to be able to successfully run mysqlcheck --repair --all-databases.

axiac
  • 68,258
  • 9
  • 99
  • 134