Using mysqldump to Download Databases via SSH
Updated 3 months ago
To run mysqldump from the terminal and download a backup of one of our databases, we need to use the --no-tablespaces option.
For example:
mysqldump --no-tablespaces -u dbuser -p dbname > backup.sql
Replace dbuser with the MySQL user that has access to the database, and dbname with the name of our database.
Why do we need to use no-tablespaces?
If we run the command without no-tablespaces, we’ll get the following error:
mysqldump: Error: 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation' when trying to dump tablespaces
The PROCESS privilege was removed from our hosting plans for security reasons.
In MySQL and MariaDB, PROCESS is a global privilege, not one limited to a single database. If this privilege is allowed, as in this cPanel article, the user can view processes across the entire server using commands such as SHOW PROCESSLIST.
This could put other customers’ data on the same server at risk if a database query contains passwords in plain text, APIs, or any other sensitive data.
Tablespaces are used in advanced InnoDB configurations, which are not necessary for downloading typical WordPress or Drupal databases, or a