https://www.imooc.com/article/41883
MySQL error
[Code: 1290, SQL State: HY000] The MySQL server is running with the –secure-file-priv option so it cannot execute this statement
通过show variables like ‘%secure_file_priv%’;
secure_file_priv参数说明
This parameter is used to limit the data import and export operations effects, such as performing LOAD DATA, SELECT ... INTO OUTFILE statements and LOAD_FILE () function. These operations require the user to have FILE privileges.
If this parameter is empty, this variable has no effect;
if this parameter is set to a directory name, MySQL service is only allowed to execute in this directory to import files and export operations. This directory must exist, MySQL service will not create it;
If this parameter is NULL, MySQL service will prohibit the import and export operations. This parameter is introduced in MySQL version 5.7.6
Attaching operation:
secure_file_priv mysqld with this configuration item to complete the restriction of importing and exporting data,
For example, we can select * from tempdb.t into outfile '/home/mysql/t.txt'; tempdb.t table data lead out; the export operation may be faced with the following problems
1, any user as long as it can perform a mysql sql statement above, and the successful implementation; it took to write the file under / home / mysql / directory?
If there is a bad guy he has been to export the data to a file directory, then one day will be filled in!
2, there is no way to restrict only the export files to / tmp / directory
We can complete the import by secure_file_priv | export restrictions
secure_file_priv
1, limit mysqld does not allow the import | export
mysqld –secure_file_prive=null
2, limit mysqld import | export can only take place in the / tmp / directory
mysqld –secure_file_priv=/tmp/
3, does not import the mysqld | export restrictions do
cat /etc/my.cnf
[mysqld]
secure_file_priv
-
Export to any directory
Making data export occur when -secure-file-priv option so it can not execute this statement
When the issue, modify /etc/mysql/mysql.conf.d/mysqld.cnf file, as
Add at the end of a secure_file_priv = "/" can export data to any directory
How these settings or not, reference http://blog.csdn.net/qq_28921653/article/details/54174341
Author: QQ595454159
link: https: //www.imooc.com/article/41883
Source: Mu class network
article published in the original Mu-class network, please indicate the source, thank you