MySQL – Minimum Privileges Required for Database Schema Backup

backupMySQLmysqldump

Which are the minimum privileges required to get a backup of a MySQL database schema? I am interested only on the schema, not on the data.

Are SELECT privileges required?

Best Answer

According to the MySQL Documentation

mysqldump requires at least the SELECT privilege for dumped tables, SHOW VIEW for dumped views, TRIGGER for dumped triggers, and LOCK TABLES if the --single-transaction option is not used. Certain options might require other privileges as noted in the option descriptions.

Thus, to run

mysqldump --no-data --routines --triggers ...

the privileges required are

You will also need the SELECT privilege on mysql.proc in order to dump Stored Procedures.