首页 > 数据库 > MySQL > 正文

处理mysqldump Got error 1290以及secure-file-priv option简解

2022-07-30 23:11:55
字体:
来源:转载
供稿:网友
       今天有个网友问,在用mysqldump备份时候遇到1290的错误
       下面是是我模拟他的报错信息
[root@potato Desktop]# mysqldump -uroot -proot -S /tmp/mysql.sock --tab=/data/mysql/mytest_3306/data/backup lala
Warning: Using a password on the command line interface can be insecure.
mysqldump: Got error: 1290: The MySQL server is running with the --secure-file-priv option so it cannot execute this statement when executing 'SELECT INTO OUTFILE'
 
      可以很清楚地从提示看到是因为mysql服务启用了--secure-file-priv,所以才无法执行。
      那么--secure-file-priv又是什么东东,应该如何解决才能是它可以备份呢?
 --secure-file-priv=name :
Limit LOAD DATA, SELECT ... OUTFILE, and LOAD_FILE() to files within specified directory
可以看到secure-file-priv参数是用来限制LOAD DATA, SELECT ... OUTFILE, and LOAD_FILE()传到哪个指定目录的。
当secure_file_priv的值为null ,表示限制mysqld 不允许导入|导出
当secure_file_priv的值为/tmp/ ,表示限制mysqld 的导入|导出只能发生在/tmp/目录下
当secure_file_priv的值没有具体值时,表示不对mysqld 的导入|导出做限制
 
然后再查一下此时参数的值
root@localhost:mysql.sock  00:28:30 [(none)]>show global variables like '%secure%';
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| secure_auth      | ON    |
| secure_file_priv |       |
+------------------+-------+
2 rows in set (0.00 sec)
已经是我们要的结果
开始进行导出
[root@potato Desktop]# mysqldump -uroot -proot -S /tmp/mysql.sock --tab=/data/mysql/mytest_3306/data/backup lala
Warning: Using a password on the command line interface can be insecure.
可以看到成功了

(编辑:错新网)

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表