12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
ADADADADAD
mysql数据库 时间:2024-11-26 22:12:25
作者:文/会员上传
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
在使用SELECT...INTO OUTPUT导出数据时出现如下的报错:root@localhost [team]>select * from team.player into outfile "/tmp/sql/player.txt";ERROR 1290 (HY000): The MyS
以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。
在使用SELECT...INTO OUTPUT导出数据时出现如下的报错:
root@localhost [team]>select * from team.player into outfile "/tmp/sql/player.txt";
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
通过报错的提示可以发现是由于secure-file-priv变量的设置所引起的,查看该变量的设置,默认的路径是/var/lib/mysql-files/
root@localhost [team]>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.01 sec)
说明:
secure_file_prive=null限制mysqld 不允许导入导出
secure_file_priv=/var/lib/mysql-files/限制mysqld的导入导出只能发生在/var/lib/mysql-files/目录下
secure_file_priv=' '不对mysqld的导入导出做限制
解决方法:
修改secure_file_prive的值或者是按照默认的路径进行导出;
windows下在my.ini文件 [mysqld]节点 下添加secure_file_priv='',然后重启mysql服务。linux下 在 /etc/my.cnf中添加secure_file_priv=''。
1、我选择前者修改默认的路径
[root@seiang mysql]# vim /etc/my.cnf
[mysqld]
secure_file_priv=''
2、重新启动mysql服务
[root@seiang mysql]# systemctl restart mysqld.service
3、再次查看该变量取值为NULL
root@localhost [team]>show variables like '%secure%';
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id: 2
Current database: team
+--------------------------+-------+
| Variable_name| Value |
+--------------------------+-------+
| require_secure_transport | OFF |
| secure_auth| ON |
| secure_file_priv| |
+--------------------------+-------+
3 rows in set (0.13 sec)
4、再次执行导出操作,成功
root@localhost [team]>select * from team.player into outfile "/tmp/player.txt";
Query OK, 3 rows affected (0.00 sec)
11-20
11-19
11-20
11-20
11-20
11-19
11-20
11-20
11-19
11-20
11-19
11-19
11-19
11-19
11-19
11-19