解决mysqldump: Got error: 1290以及secure-file-priv option简解
发表于:2026-10-31 作者:千家信息网编辑
千家信息网最后更新 2026年10月31日,今天有个网友问,在用mysqldump备份时候遇到1290的错误 下面是是我模拟他的报错信息[root@potato Desktop]# mysqldump -uroot -proot -S /tmp
千家信息网最后更新 2026年10月31日解决mysqldump: Got error: 1290以及secure-file-priv option简解今天有个网友问,在用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:14:52 [(none)]>show global variables like '%secure%'; +------------------+-------+ | Variable_name | Value | +------------------+-------+ | secure_auth | ON | | secure_file_priv | NULL | +------------------+-------+ 2 rows in set (0.00 sec)
清楚地看到secure_file_priv 的值是NULL,说明此时限制导入导出的 所以应该改变该参数 可是查看了mysql.cnf中居然没有对这个参数进行设定,就说明这个参数默认便是null 所以再mysql.cnf中的[mysqld]加入secure_file_priv = 再重启mysql服务
然后再查一下此时参数的值 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. 可以看到成功了
[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:14:52 [(none)]>show global variables like '%secure%'; +------------------+-------+ | Variable_name | Value | +------------------+-------+ | secure_auth | ON | | secure_file_priv | NULL | +------------------+-------+ 2 rows in set (0.00 sec)
清楚地看到secure_file_priv 的值是NULL,说明此时限制导入导出的 所以应该改变该参数 可是查看了mysql.cnf中居然没有对这个参数进行设定,就说明这个参数默认便是null 所以再mysql.cnf中的[mysqld]加入secure_file_priv = 再重启mysql服务
然后再查一下此时参数的值 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. 可以看到成功了
参数
限制
清楚
备份
目录
服务
不对
成功
信息
又是
数据
数据库
时候
结果
网友
错误
提示
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
耶加雪菲
互联网科技公司简介
互联网金融监管科技数据
互联网与科技发展
金融科技创新监管互联网金融
美国互联网科技
狮子座互联网科技有限公司
壹账通互联网科技
深圳天众互联网科技公司
中国互联网金融科技基金
华脉科技工业互联网产品
成都铂石互联网科技做什么的
厦门比较好的科技互联网公司
荆州市昕露互联网络科技有限公司
青岛科技大学互联网大赛研究生
佛山市翊博互联网络科技有限公司
广东工业互联网大赛深圳学泰科技
绵阳真晨互联网科技有限公司
互联网科技大佬云集
科技互联网企业在行动
科技互联网企业
美国互联网科技
万易互联网科技有限公司
互联网科技素材视频竖屏
黑科技闪耀互联网之光
上海京穆互联网科技有限公司
黑科技 体验场景 互联网大会
宇信科技在杭州互联网排第几
互联网安防科技感
中国科技和美国互联网