报错:

[root@zedu test]# mysqldump -h127.0.0.1 -uroot -p --single-transaction --add-drop-database --tab="/root/test/" cacti Enter password: Warning: A partial dump from a server that has GTIDs will by default include the GTIDs of all transactions, even those that changed suppressed parts of the database. If you don't want to restore GTIDs, pass --set-gtid-purged=OFF. To make a complete dump, pass --all-databases --triggers --routines --events. SET @MYSQLDUMP_TEMP_LOG_BIN = @@SESSION.SQL_LOG_BIN; SET @@SESSION.SQL_LOG_BIN= 0;

-- -- GTID state at the beginning of the backup --

SET @@GLOBAL.GTID_PURGED='7f308b50-7701-11e8-8ee3-000c2923f3c9:1-31115'; 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'

查看配置文件:

[root@zedu /]# grep "secure" /data/mysql/mysql3306/my3306.cnf
secure_file_priv                    =/tmp                               #      null

解决:

[root@tedu /]# mysqldump -h127.0.0.1 -uroot -p --single-transaction --add-drop-database --tab="/tmp" cacti Enter password: Warning: A partial dump from a server that has GTIDs will by default include the GTIDs of all transactions, even those that changed suppressed parts of the database. If you don't want to restore GTIDs, pass --set-gtid-purged=OFF. To make a complete dump, pass --all-databases --triggers --routines --events. SET @MYSQLDUMP_TEMP_LOG_BIN = @@SESSION.SQL_LOG_BIN; SET @@SESSION.SQL_LOG_BIN= 0;

-- -- GTID state at the beginning of the backup --

SET @@GLOBAL.GTID_PURGED='7f308b50-7701-11e8-8ee3-000c2923f3c9:1-31115'; SET @@SESSION.SQL_LOG_BIN = @MYSQLDUMP_TEMP_LOG_BIN;

原因:

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)
 
可以看到成功了
 
 

mysqldump 使用--tab=path参数时提示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'的更多相关文章

  1. Mac上csv导入mysql提示错误[Error Code] 1290 - The MySQL server is running with the --secure-file-priv option解决办法

    1.进入mysql查看secure_file_prive的值 $mysql -u root -p mysql>SHOW VARIABLES LIKE "secure_file_priv ...

  2. mysql提示错误[Error Code] 1290 - The MySQL server is running with the --secure-file-priv option解决办法

    1.进入mysql查看secure_file_prive的值 $mysql -u root -p mysql>SHOW VARIABLES LIKE "secure_file_priv ...

  3. 当用命令导入csv文件时提示错误[Err] 1290 - The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

        安装之后没有my.ini配置文件怎么办,因为自己安装的是zip压缩版的mysql,所以再5.7之后就没有my.ini配置文件,所以有时候需要去自己创建一个叫my.ini的配置文件,但是特别 要 ...

  4. 连接mysql数据库时提示2003 can't connect to MySQL server on ip(10060)的解决办法

    今天部署 JavaWeb 项目到云服务器,突然出现can t connect to MySQL server on ip的问题 经过了一些检查,认为很有可能是防火墙的原因.下面是检查的具体操作: 因为 ...

  5. csv导入mysql提示错误[Error Code] 1290 - The MySQL server is running with the --secure-file-priv option 解决方法【转】

    解决方法: 1.进入mysql查看secure_file_prive的值 mysql>SHOW VARIABLES LIKE "secure_file_priv"; secu ...

  6. csv导入mysql提示错误[Error Code] 1290 - The MySQL server is running with the --secure-file-priv option

    解决方法: 1.进入mysql查看secure_file_prive的值 mysql>SHOW VARIABLES LIKE "secure_file_priv"; secu ...

  7. TortoiseGit做push时提示Disconnected: No supported authentication methods available (server sent: publickey)错误

    通过Git从远程服务器上获得到自己的项目,但是通过TortoiseGit做push时提示Disconnected: No supported authentication methods availa ...

  8. 连接Mysql提示Can’t connect to local MySQL server through socket的解决方法

    mysql,mysqldump,Mysqladmin,php连接mysql服务常会提示下面错误: ERROR 2002 (HY000): Can't connect to local MySQL se ...

  9. 启动Mysql服务提示Can’t connect to local MySQL server through socket的解决方法

    启动Mysql服务常会提示下面错误: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/ ...

随机推荐

  1. 论文阅读 | ERNIE: Enhanced Representation through Knowledge Integration

    摘要 知识加强的语义表示模型. knowledge masking strategies  :  entity-level  masking   / phrase-level masking    实 ...

  2. SGI STL泛型heap算法分析

    heap性质 heap本质是用一个数组表示的完全二叉树,并且父节点总是大于(或者小于)子节点的值.在STL中用于实现优先队列(priority_queque).堆排序是排序算法中是稳定效率最高的一种. ...

  3. Arthas查看Spring配置

    在开发过程经常有同学问:"我这个配置更新提交了,怎么样知道项目中是否已经更新使用新值?" 常用的方法是添加日志打印该值判断是否更新.今天我们用Arthas来实现项目中配置值实时读取 ...

  4. POSTGRESQL日期函数大全

    一:各个数据中的连接符 SqlServer的连接符:+(加号) Sqlite的连接符:.(点) PostgreSQL的连接符:||(或) 二: 今天在PostgreSQL计算日期的时候,翻了一些资料, ...

  5. PDO简单的DB类封装

    <?php class DB{ private $dbs = ""; private $fields = "*"; private $tables = n ...

  6. 初识WSGI接口

    WSGI WSGI全称为Web Server Gateway Interface,WSGI允许web框架和web服务器分开,可以混合匹配web服务器和web框架,选择一个适合的配对.比如,可以在Gun ...

  7. Array Product CodeForces - 1042C (细节)

    #include <iostream> #include <sstream> #include <algorithm> #include <cstdio> ...

  8. 怎样理解Node接口 / ParentNode接口 / ChildNode接口

    ParentNode 和 ChildNode可以理解为是Node的子集, 它对一些具有父节点或子节点的节点提供了一些额外的方法和属性, 比如: 1. 继承了ParentNode的接口有: 元素节点 / ...

  9. C#面向对象20 序列化和反序列化

    序列化和反序列化 序列化是把一个内存中的对象的信息转化成一个可以持久化保存的形式,以便于保存或传输,序列化的主要作用是不同平台之间进行通信,常用的有序列化有json.xml.文件等   一.序列化为j ...

  10. 汉明码(hamming code)

    hamming code用于磁盘RAID 2中, 关于汉明码的讲解可以看这篇博文,介绍的很详细.最重要是最后的结论: 汉明码属于分组奇偶校验,P4P2P1=000,说明接收方生成的校验位和收到的校验位 ...