mysql数据库将文件内容加载到表中报错:

mysql> LOAD DATA LOCAL INFILE '/path/pet.txt' INTO TABLE pet
LINES TERMINATED BY '\r\n';
ERROR 1148: The used command is not allowed with this MySQL version

原因:

涉及到数据库安全的问题,本地导入文件的参数没有打开。

解决方法:

  • 服务器端:
SHOW VARIABLES LIKE '%local%';

  得到  local_infile   OFF  即该变量未开启

SET GLOBAL local_infile=1;

  这时还是报错的~

  • 客户端:

  连接数据库时

mysql -u Name -p --local-infile=1;

注:这两步都需要执行喔!

另:以上是初学时不太严谨用的root用户,但是数据库一般使用普通用户,我参考此篇创建及授权的

https://www.cnblogs.com/sos-blue/p/6852945.html

以下为用普通用户导入的全过程

MySQL8.0加载文件内容报错: ERROR 1148: The used command is not allowed with this MySQL version的更多相关文章

  1. 【IntellJ IDEA】idea启动测试类报错Error running 'Test1.test': Command line is too long. Shorten command line for Test1.test or also for JUnit default configuration.

    idea启动测试类报错 Error running 'Test1.test': Command line is too long. Shorten command line for Test1.tes ...

  2. 【mysql】 load local data infield 报错 ERROR 1148 (42000): The used command is not allowed with this MySQL version

    mysql> load data local infile '/Users/flint/learn/mysql/pet' into table bx_pet; 执行报错 ERROR 1148 ( ...

  3. MYSQL8.0以上版本ROOT密码报错及修改

    在登录数据库过程中,如果遇到忘记root密码时,该如何解决? 1.使用管理员权限打开命令提示符,在命令行中输入: net stop mysql  2.待mysql服务停止后,输入: mysqld -- ...

  4. Win下GCC报错 error: ‘for’ loop initial declarations are only allowed in C99 mode

    ##报错## 用GCC编译for循环会出现以下错误 error: 'for' loop initial declarations are only allowed in C99 mode 如图所示: ...

  5. 未能加载文件或程序集 Newtonsoft.Json, Version=4.5.0.0 的报错,解决方法

    使用httpclient测试webapi的时候客户端报错: {"未能加载文件或程序集“Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, P ...

  6. ABP 3.7版本迁移数据库报错未能加载文件或程序集“Castle.Core, Version=4.0.0.0”

    ABP 3.7 3.8版本升级后迁移数据库,报错未能加载文件或程序集“Castle.Core, Version=4.0.0.0”,System.ComponentModel.Annotations也可 ...

  7. C# VS 调试报错:未能加载文件或程序集“Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed”或它的某一个依赖项

    今天在使用 VS(VisualStudio) 调试一个复杂的 WinForm 程序,总是提示错误: 未能加载文件或程序集"Newtonsoft.Json, Version=4.5.0.0, ...

  8. SharePoint 2016 vs部署报错:无法加载功能xxx未能加载文件或程序集xxx或它的某一个依赖项。系统找不到指定的文件

    环境描述: SharePoint 2016 单服务器场模式 开发工具:VS2017,项目类型(功能):计时器. 问题描述: 在用vs直接部署时,报错如下: 部署步骤"激活功能"中出 ...

  9. Newtonsoft.Json报错:未能加载文件或程序集"..."或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配

    Newtonsoft.Json报错:未能加载文件或程序集"..."或它的某一个依赖项.找到的程序集清单定义与程序集引用不匹配.   □ 背景分析 在帮助类库中使用了Newtonso ...

随机推荐

  1. 【SSO单点系列】(6):CAS4.0 单点流程序列图(中文版)以及相关术语解释(TGT、ST、PGT、PT、PGTIOU)

    CAS 相关的内容好久没写了,可能下周会继续更新一些内容吧. 在上一篇中的单点流程序列图由于是从官网直接下载来的,上面都是英文,可能有的朋友看不懂,因此修改成中文的. PS:只修改了一个,第二个图明天 ...

  2. ThinkPHP U方法

    方法1: {:U('User/Booking/bookingdetails')} 方法2: {:U('User/Booking/bookingdetails')}"+"&a ...

  3. rpm命令-以jenkins为例

    1.列出所有安装的Jenkins rpm -qa | grep jenkins 2.软件是否安装:例如:jenkins是否安装 rpm -qa | grep jenkins 3.rpm -ql 列出软 ...

  4. Spring学习笔记(一)—— Spring介绍及入门案例

    一.Spring概述 1.1 Spring是什么 Spring是一个开源框架,是于2003年兴起的一个轻量级的Java开发框架, 由Rod Johnson 在其著作<Expert one on ...

  5. python之常用的数据类型

    1. 变量的定义以及声明 在学习变量之前,咱们需要知道变量的命名规则: ① 变量必须由数字字母下划线构成,如a_1 ② 变量名不能以数字开头,如1a ③ 需要遵循驼峰命名法 给变量赋值通常采用“=”, ...

  6. 未在本地计算机上注册microsoft.jet

      未在本地计算机上注册microsoft.jet http://www.microsoft.com/zh-cn/download/confirmation.aspx?id=13255

  7. 118th LeetCode Weekly Contest Powerful Integers

    Given two non-negative integers x and y, an integer is powerful if it is equal to x^i + y^j for some ...

  8. c#工具类之Bitmap缩放帮忙类

    using System.Drawing; using System.Drawing.Drawing2D; /// <summary> /// BitmapHelper /// </ ...

  9. [转] Spring Boot中Web应用的统一异常处理

    [From] http://blog.didispace.com/springbootexception/ 我们在做Web应用的时候,请求处理过程中发生错误是非常常见的情况.Spring Boot提供 ...

  10. Maven-常规问题

    1.编译(compile)Maven项目时,报错: -Dmaven.multiModuleProjectDirectory system property is not set. 处理方案:Windo ...