LoginSignup
6
5

More than 1 year has passed since last update.

MySQLDump で tablespaces の PROCESS privilege エラーが出だした時の対処方法

Last updated at Posted at 2021-05-25

いつも使っていた MySQL Dump のシェルコマンドで、以下のエラーがでました。

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

さくらインターネットのスタンダードプランのレンタルサーバーでも、日時バックアップをシェルで動かしているのですが、1月ぐらいから出始め、なんでだろうと思っていました。

原因は MySQL 5.7.31 からの tablespaces の仕様変更によるものらしいです。

MySQL 5.7.31 のリリースノートによると

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)

ということは、さくらインターネットの MySQL サーバーもアップデートが行われたんですね。

Tablespaces とは

MySQL Dump をする際に、--no-tablespaces オプションを加えると大丈夫のようです。

tabelspaces とは、MySQL 5.6 から加わった機能で、データーベース側で作成されるファイルを任意に指定できる機能のようです。

5.6 以前から使われている CMS やアプリケーションは一般的に、 tablespaces の指定をしていないと思われるので、tablespaces 情報が出力されなくても問題はありません。

なので、MySQL 5.7 以前から使われている MySQL を使うアプリケーションで、特に指定が無ければ、MySQL Dump 時に --no-tablespaces オプションを加えると良いでしょう。

サンプル

mysqldump -h [ホスト] -u [DBユーザー名] --password="[DBパスワード]" --no-tablespaces --single-transaction [データベース名] > [保存先.sql]

--single-transaction オプションは InnobDB メインな DBでデータの整合性保つように追加しています。

参考 (感謝)

6
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
5