mysqldump error: Access denied, you need the PROCESS privilege
We have already looked at export and import of large SQL files in MySQL. Sometimes these operations are done on the client’s server, where your database user has limited rights, and mysqldump stops with an error:
mysqldump: Error: ‘Access denied; you need (at least one of) the PROCESS privilege(s) for this operation’ when trying to dump tablespaces
The solution is very simple 🙂 Moreover, it is right in the error text.
Problem: How to fix this mysqldump error without the PROCESS privilege?
Solution: Add the --no-tablespaces option to the command:
mysqldump --no-tablespaces -h localhost -u user_name -p database_name > /path/to/file/database.sql
The password is asked after you run the command.
Why it happens
Since MySQL 5.7.31 and 8.0.21, mysqldump needs the PROCESS privilege to read the tablespace information, and it tries to do that by default. On shared hosting and on most client servers a normal database user does not have this privilege. A WordPress database does not need the tablespace information: the dump of the tables and the data is complete without it.
If you can manage the server, you can give the privilege instead (it is global, so it is granted on *.*):
GRANT PROCESS ON *.* TO 'user_name'@'localhost';
A complete command
For a backup of a live site I usually add a few more options:
mysqldump --no-tablespaces --single-transaction --quick \
-h localhost -u user_name -p database_name | gzip > /path/to/file/database_$(date +%F).sql.gz
--single-transactionmakes a consistent dump of InnoDB tables without locking them, so the site keeps working;--quickreads the rows one by one instead of loading the whole table into memory;gzipcompresses the dump on the fly.
Sources: