mysql>导出数据为txt时报错:The MySQL server is running with the --secure-file-priv option so it cannot execut


mysql> select * from anserchapp.searchApp into outfile '/home/data/searchApp/en/searchApp_cn.txt';

ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement


原因:

目录无权限


解决:

法1,

直接使用默认的权限文件夹(/var/lib/mysql-files/)作为导出目录即可,

mysql> select * from anserchapp.searchApp into outfile '/var/lib/mysql-files/sapp';
Query OK, 137784 rows affected (45.88 sec)


法2,

修改MySQL安装路径(/etc/mysql/)下的my.cnf,在末尾添加“secure-file-priv=路径名”这一行,重启mysql

将要通过load data infile的文件放在上面所定义的路径下进行操作即可, --- (我这里没修改成功)



你可能感兴趣的:(Trouble,Shooting,mysql)