我在用着:
SELECT * FROM accounts INTO OUTFILE("C:/Users/Home/Documents/test.txt")
但我得到了错误:
(db:1290) The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
我无权更改数据库的安全设置,但想知道是否有一些替代命令可以解决此问题。谢谢
我在用着:
SELECT * FROM accounts INTO OUTFILE("C:/Users/Home/Documents/test.txt")
但我得到了错误:
(db:1290) The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
我无权更改数据库的安全设置,但想知道是否有一些替代命令可以解决此问题。谢谢
这是设计使然。MySQL secure-file-priv 选项限制使用 LOAD DATA INFILE 或 SELECT INTO OUTFILE 可以读取(或写入)的目录。
您可以使用以下命令显示允许的目录:
SHOW VARIABLES LIKE "secure_file_priv"
然后你应该将你的导出指向这个目录。
在您的 MySQL 服务器的配置中,将此行放在下面[mysqld]
并重新启动服务
secure_file_priv=/tmp/ #the dir you want to put the result file
或者
mysql -s -e 'SELECT * FROM accounts' | cat > /path/to/file