LoginSignup
1
0

More than 5 years have passed since last update.

【MYSQL】データをエクスポートしようとしたらsecure-file-privがどうのこうのって言われたときの対処法

Posted at

ローカルのMYSQLからデータをCSVでエクスポートしようとしたら

The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

って怒られたのです。

mysql> SELECT @@global.secure_file_priv;
+---------------------------+
| @@global.secure_file_priv |
+---------------------------+
| NULL                      |
+---------------------------+

ここがNULLなのがダメらしい。

対処法

my.cnfの配置

sudo cp /usr/local/opt/mysql@5.6/support-files/my-default.cnf /etc/my.cnf

my-default.cnfへのパスはmysqlのバージョンによって変わってくるのでよしなに。

my.cnfの編集

sudo vim /etc/my.cnf

[mysqld]
secure-file-priv = ""

を追記

mysqlの再起動

mysql.server restart

mysql> SELECT @@global.secure_file_priv;
+---------------------------+
| @@global.secure_file_priv |
+---------------------------+
|                           |
+---------------------------+
1 row in set (0.00 sec)

カラです。(my.cnfで設定したとおり)

これでいけるはずです。

詳しい原因は調べれば簡単にでてきます。

1
0
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
1
0