MYSQL导入数据出现时出现The MySQL server is running with the --secure-file-pri option so it cannot execute this statement问题解决
注:我的系统是ubuntu 16.04, mysql版本是5.7.6
在mysql中通过下面命令查看 secure-file-priv 当前的值是什么:
show variables like '%secure%';
说明:
secure_file_prive=null – 限制mysqld 不允许导入导出
secure_file_priv=/tmp/ – 限制mysqld的导入导出只能发生在/tmp/目录下
secure_file_priv=’ ’ – 不对mysqld 的导入 导出做限制
如上图,我的mysql导入导出数据只能在/var/lib/mysql-files目录下,要想从任意文件夹导入导出数据,要做以下配置:
修改/etc/mysql/mysql.conf.d/mysqld.cnf文件,如图
进入/etc/mysql/mysql.conf.d
输入命令 sudo vim mysqld.conf
打开编辑mysqld.conf文件,在末尾添加一句secure_fil