MySQL 报错 ERROR 1290 (HY000): running with the --secure-file-priv
2017-07-06 15:48
483 查看
MySQL安全文件权限
MySQL导出文件时报错:
mysql> select * from t_user limit 5 into outfile '/tmp/test.csv'; ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
报错原因:
secure_file_priv 设置了指定目录,需要在指定的目录下进行数据导出
mysql> show variables like '%secure%'; +--------------------------+-----------------------+ | Variable_name | Value | +--------------------------+-----------------------+ | require_secure_transport | OFF | | secure_auth | ON | | secure_file_priv | /var/lib/mysql-files/ | +--------------------------+-----------------------+ 3 rows in set (0.27 sec)
如果 secure_file_priv 参数为空,则需要在配置文件中设置该参数,并重启数据库
[mysql@localhost percona]$ service mysqld restart [mysql@localhost percona]$ vim /etc/my.cnf [mysqld] ... secure_file_priv='/var/lib/mysql-files/' ...
重启后:
mysql> select * from t_user limit 5 into outfile '/var/lib/mysql-files/test.csv'; Query OK, 5 rows affected (0.01 sec)
secure_file_priv 参数说明:
这个参数用来限制数据导入和导出操作的效果,例如执行LOAD DATA、SELECT … INTO OUTFILE语句和LOAD_FILE()函数。这些操作需要用户具有FILE权限。如果这个参数为空,这个变量没有效果;
如果这个参数设为一个目录名,MySQL服务只允许在这个目录中执行文件的导入和导出操作。这个目录必须存在,MySQL服务不会创建它;
如果这个参数为NULL,MySQL服务会禁止导入和导出操作。这个参数在MySQL 5.7.6版本引入。
相关文章推荐
- ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot exec
- ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot exec
- ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it ...statemet
- ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot exec
- ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
- mysql 导出数据到文件 ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so
- ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot exec
- ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot exec
- ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot exec
- Windows10 MySQL5.7.21.0 ERROR 1290 (HY000): The MySQL server is running with the --secure-file-p解决办法
- ubuntu 下Mysql导入导出文件报错:ERROR 1290 (HY000): --secure-file-priv
- ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option
- Windows下MySQL导入csv文件ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv opti
- mysqldump: Got error: 1290: The MySQL server is running with the --secure-file-priv option so it can
- csv导入mysql提示错误[Error Code] 1290 - The MySQL server is running with the --secure-file-priv option 解决方
- csv导入mysql提示错误[Error Code] 1290 - The MySQL server is running with the --secure-file-priv option 解决方法【转】
- mysql--secure-file-priv及“ERROR 13 (HY000): Can't get stat of 问题macbook
- Mac上csv导入mysql提示错误[Error Code] 1290 - The MySQL server is running with the --secure-file-priv option解决办法
- mysql导出表到CSV文件方法及提示错误[Err] 1290 - The MySQL server is running with the --secure-file-priv option解决办法
- Mac上csv导入mysql提示错误[Error Code] 1290 - The MySQL server is running with the --secure-file-priv option