Disable secure-file-priv for MySQL

3319
3

Trying to execute some special MySQL queries (for example — select into outfile query) you could bump into such an error:

Error Code: 1290. The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

This option is used to restrict on which folders you're allowed to load data from or to. There are some cases when this option is useful, however in most cases it's not, so the simplest solution is to disable it. To do so open your MySQL configuration file. On Linux it is usually located at:

/etc/my.cnf

Find [mysqld] section and disable this option by setting an empty string for secure_file_priv parameter:

[mysqld]
# ...
secure_file_priv=""

Restart MySQL service and you're all set up:

systemctl restart mysqld
Rate this post: