mysql导出数据到外部文件

发现导入文件一直出错,显示ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement。
看了网上的很多办法都不成功,后来发现原来是因为在MySQL 5.7.6版本之后,导入文件只能在secure_file_priv指定的文件夹下
所以用show variables like '%secure%';命令显示文件目录

解决办法修改数据库配置文件

插入一行代码

secure_file_priv="D:/phpstudy/"

=号后面的是要导出的路径,可以自己指定,经测试只能将数据导入到该文件夹,其它文件夹无效,子文件也不行

原文地址:https://www.cnblogs.com/xiaogou/p/9165913.html