MYSQL导入数据出现The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

mysql> 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.27 sec)

 
如果value值为null,则为禁止;如果有文件夹目录,则只允许改目录下文件(测试子目录也不行);如果为空,则不限制目录;

重启mysql:

关闭mysql:mysqladmin -uroot shutdown -p

启动mysql:

su root

./bin/mysqld_safe --basedir=/usr/local/mysql/ --datadir=/home/common/mysql_data/ --user=mysql &

set global secure_file_priv='';
ERROR 1238 (HY000): Variable 'secure_file_priv' is a read only variable
报错原因:
参数为只读参数,需要在配置文件/etc/my.cnf或windows下的my.ini中更改该参数,之后重启数据库

secure_file_priv参数说明
这个参数用来限制数据导入和导出操作的效果,例如执行LOAD DATA、SELECT ... INTO OUTFILE语句和LOAD_FILE()函数。这些操作需要用户具有FILE权限。
如果这个参数为空,这个变量没有效果;
如果这个参数设为一个目录名,MySQL服务只允许在这个目录中执行文件的导入和导出操作。这个目录必须存在,MySQL服务不会创建它;
如果这个参数为NULL,MySQL服务会禁止导入和导出操作。这个参数在MySQL 5.7.6版本引入。

重新导入:

load data infile '/home/xxx/Desktop/3333/head.csv' 
-> into table `table` 
-> character set utf8 
-> fields terminated by '\t'
-> lines terminated by '\n';

导入数据时出错:

ERROR 1261 (01000): Row 1 doesn't contain data for all columns

修改 sql_mode:

set global sql_mode='';

导入数据可能出现的问题及解决方案:

Error 1261(01000):Row XX doesn't contain data for all columns

Method:本错误信息提示第XX行数据不足,查看你数据库表中建立的字段和数据中提供的字段数目是否相同,只有二者数目一致,才可以导入。

Error 1366(HY000):Incorrect string value: '\x95F\xBE\xF4\xC6\xFB...' for column 'enterprise' at row XX

Method:本错误信息提示第XX行‘enterprise’字段出现不正确的字符,查找之后发现我在这个字段的数据含有2个比较复杂的汉字“旻爵”,可能无法识别,把这2个字去掉之后这个错误便消失了。

Error 1366(HY000):Incorrect integer value: ' ' for column 'money' at row XX

Method:本错误信息提示第XX行出现不正确的int值,可能原因是数据库“money”字段定义的数据类型是int型,而数据中存储的却不是int型(可能是double型、float型之类的)--这种情况一般是数据类型出现不一致的问题。

Error 1265(01000):Data truncated for column 'money' at row XX

Method:本错误信息提示第XX行数据被截断,可能原因是数据库中‘money’字段是double型或者float型,但是数据文件中可能存在null值,即这个数据值可能是不存在的,解决方案是将这个缺失的字段补‘0’。

--secure-file-priv option so it cannot execute this statement的更多相关文章

  1. ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

    centos7.5 使用into outfile备份失败 问题: mysql> select * from world.city into outfile '/tmp/world_city.da ...

  2. Windows sql语句正则匹配导出数据到本地 The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

    尝试使用 into outfile导出数据的时候出现错误: The MySQL server is running with the --secure-file-priv option so it c ...

  3. 【MySQL报错】ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

    ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot exec ...

  4. 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'

    报错: [root@zedu test]# mysqldump -h127.0.0.1 -uroot -p --single-transaction --add-drop-database --tab ...

  5. The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement

    skip-grant-tables下 GRANT ALL PRIVILEGES ON *.* TO helei IDENTIFIED BY 'MANAGER' WITH GRANT OPTION; 执 ...

  6. mysql错误:The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement解决方法

    本文为大家讲解的是mysql错误:The MySQL server is running with the --skip-grant-tables option so it cannot execut ...

  7. MYSQL导入CSV格式文件数据执行提示错误(ERROR 1290): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement.

    MYSQL导入CSV格式文件数据执行提示错误(ERROR 1290): The MySQL server is running with the --secure-file-priv option s ...

  8. MySQL报错解决:The MySQL server is running with the --read-only option so it cannot execute this statement

    MySQL报错:The MySQL server is running with the --skip-grant-tables option so it cannot execute this st ...

  9. 当用命令导入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的配置文件,但是特别 要 ...

随机推荐

  1. winscp上传出现时间戳提示错误

    文件ngx_http_access_module.c上传成功,但是在设置权限和/或时间戳时发生错误.具体内容上图:         我们可以选择 ‘中止’,文件是可以上传成功的,就是每次都会提示这个信 ...

  2. IE7下面iframe滚动条无法用鼠标轮滚 其他浏览器可以

    1.让 IFRAME 隐藏滚动条,通常的做法就是在嵌入  IFRAME 的页面的 CSS 中指定以下规则:   html, body {overflow: hidden}   2.如果只是想隐藏横向滚 ...

  3. JMeter------ _time 函数的使用(时间戳、当前时间)

    操作步骤: 1.通过函数助手,生成一个_time 函数: 2.如果参数为时间戳,那公式为: ${__time(,)}  :  默认该公式精确到毫秒级别, 13位数 ${__time(/1000,)}  ...

  4. 02 java 基础:java 文件名与类名关系 CLASSPATH

    java 类修饰符:通常情况下使用 public 修饰,此时,java 强制要求 .java 文件名需与该 public 修饰类名一致,否则无法编译通过.如若没有加修饰符,文件名与类名可无任何关联. ...

  5. H5游戏开发:贪吃蛇

    贪吃蛇的经典玩法有两种: 积分闯关 一吃到底 第一种是笔者小时候在掌上游戏机最先体验到的(不小心暴露了年龄),具体玩法是蛇吃完一定数量的食物后就通关,通关后速度会加快:第二种是诺基亚在1997年在其自 ...

  6. bootstrap中如何多次使用一个摸态框

    /**弹出框设置**/ function showjcziimodal(url, width) { $("#jczii-modal").remove();//如果存在此Id的Mod ...

  7. IO复用之epoll系列

    epoll是什么? epoll是Linux内核为处理大批量文件描述符而作了改进的poll,是Linux下多路复用IO接口select/poll的增强版本,它能显著提高程序在大量并发连接中只有少量活跃的 ...

  8. 在Eclipse调试Weblogic上的web项目

    概述 参考原文:weblogic debug配置. weblogic版本:BEA WebLogic Platform 8.1 工作原理: 利用java tools里面的jdb程序连接远程的JAVA虚拟 ...

  9. Aizu 2784 Similarity of Subtrees(树哈希)

    Similarity of Subtrees Define the depth of a node in a rooted tree by applying the following rules r ...

  10. Sqli-labs less 1

    Less-1 我们可以在http://127.0.0.1/sqllib/Less-5/?id=1后面直接添加一个 ' ,来看一下效果: 从上述错误当中,我们可以看到提交到sql中的1'在经过sql语句 ...