Guys I have an application that use SELECT OUTFILE to be used as cache for another application, so, it outputs straight to /dev/shm/some/folder.

As it runs on a background server, I have no issue disabling all mysql security, the option secure_file_priv isn't set in the my.ini but is default set by the version, how to disable this folder security?

[MySQL Version]
/usr/sbin/mysqld  Ver 5.7.12-0ubuntu1 for Linux on x86_64 ((Ubuntu))

[Ubuntu Version]
Description:    Ubuntu 16.04 LTS
Release:        16.04
Codename:       xenial

2 Answers 2


The mysql documentation on secure_file_priv states that the variable is set to a default, platform-specific filesystem location, to make it secure by default.

That said, you need to explicitly set the variable to an empty string in your configuration to disable this security feature.

For Ubuntu, edit the file /etc/mysql/mysql.conf.d/mysqld.cnf and add the following line at the end:


Then make sure to restart the service.

  • Thanks!! Actually I've made a workaround using only "/" instead of the path, assuming everypath were goingo to be inside of it.
    – Diogo Paim
    Aug 3, 2016 at 17:52
  • On Workbench (after giving the password again), SHOW VARIABLES LIKE "secure_file_priv"; is still giving me /var/lib/mysql-files/, and I still can't load data.
    – Rodrigo
    Jul 21, 2021 at 15:42

For me adding to the end of the above file didn't work.

I added it to the /etc/mysql/my.cnf file in the [mysqld] section and it worked.

You may be able to create that section in the above file and it also work, I didn't test it.

After the server re-start you can test with SHOW VARIABLES LIKE "secure_file_priv"; provided you have priveleve to do so.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.