mysqldumpでwhen trying to dump tablespacesエラーがでるときがある




この記事は最終更新日から1年以上経過しています。

最近さくらインターネットやAWSで構築されたサーバー上でmysqldumpコマンドを使い、データベースのバックアップを取得しようとするときに以下のエラーに遭遇することが多くなりました。

mysqldump: Error: ‘Access denied; you need (at least one of) the PROCESS privilege(s) for this operation’ when trying to dump tablespaces

このエラーの解決方法についてまとめます。

解決方法

まずは解決方法です。
これはmysqldumpに–no-tablespacesオプションをつけることで解決します。
以下のような感じです。

mysqldump --no-tablespaces --user=xxxx -p --host=xxxx database_name

エラーが出る原因

MySQL5.7.31(2020年7月13日GA版)で以下の変更があったことが原因でした。

https://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-31.html
Incompatible Change: Access to the INFORMATION_SCHEMA.FILES table now requires the PROCESS privilege.

This change affects users of the mysqldump command, which accesses tablespace information in the FILES table, and thus now requires the PROCESS privilege as well. Users who do not need to dump tablespace information can work around this requirement by invoking mysqldump with the –no-tablespaces option. (Bug #30350829)

mysqldumpコマンドに影響がある変更で、INFORMATION_SCHEMAにあるFILESテーブルのテーブルスペース情報を参照するための権限が必要みたいなことが書いてありました。
テーブルスペース情報が必要なければ–no-tablespacesオプションを使用することで回避できるということでした。