ローカルの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で設定したとおり)
これでいけるはずです。
詳しい原因は調べれば簡単にでてきます。