解决004--Loading local data is disabled; this must be enabled on both the client and server sides问题及解决
因为下载了SQLyog的ultimate版本,现在就可以导入外部的数据了。有着之前使用insert into插入语句来添加近50条有着大概10个字段的记录的经历之后,本着能够导入现成的数据就导入的想法,于是我就使用SQLyog将我的csv文件导入到我们想要的表中:
首先我们有一张表20student1,并且里面的字段也已经写好(都与我们的csv文件里面的字段名及对应的数据类型一一对应)

之后我们鼠标右击名为20student1的表→选择“导入”→点击“导入使用本地加载的csv数据”

如上选择好数据后,点击“导入”后就出现了如下报错

Loading local data is disabled; this must be enabled on both the client and server sides
翻译:forLoading local data被禁用;这必须在客户端和服务器端都启用
我们的这种报错是属于mysql导入数据报错:local_infile服务器变量指示能否使用load data local infile命令。该变量为OFF时,禁用客户端的load data local infile命令,只要我们将该变量设置为ON时, 报错才会消失。
我们先输入show global variables like 'local_infile';命令来查看local_infile服务器的变量是off还是on,如下图所示,当前我们的服务器变量的变量值为off,因此我们导入数据时才会报错。

快捷方法--一次性
如果当前没有什么时间的话,可以使用快捷方法,还是在命令行提示窗口里面进行,现在我们使用如下命令将local_infile的变量值设置为on,on也的数值就是1,用哪个都一样的。
在mysql中输入命令set global local_infile=1;

接着我们退出mysql,再次进入查看local_infile服务器的变量值时显示是开着的

这次我们再去查看的时候就会发现是开着的了。
修改文件--永久性
我们也提到了, 上面的方法并不是很好的方法,只能一次性,下次再导入数据时,还是会是默认的off变量值。因此我们可以去修改mysql目录下的my.ini文件,达到使该服务器的变量值永久性的是on。如下:

打开该文件后,我们在有[mysqld],[mysql]字样的下一行加上local_infile=ON命令
[mysqld]
local_infile=ON
[mysql]
local_infile=ON
如下图所示:

修改my.ini文件后,记得保存。
之后我们去重启mysql服务,使我们修改的my.ini文件生效
首先可以使用快捷键Ctrl+shift+esc来打开任务管理器,接着找到mysql开头的程序,鼠标右击,选择“重新启动”。如下所示,当前的mysql8的pid为5576

重启成功后,mysql8的pid变成了14880
接着我们再去查看local_infile的变量值,可以看到已经变成了on

之后我们再去SQLyog中导入数据,出现如下警告时,不用管,直接忽略,点击“确定”即可

导入数据之后我们想要将该对象浏览器刷新才能将我们的数据加载进来。

之后去打开我们的20student1表格,可以看到数据已经导入成功了。

解决004--Loading local data is disabled; this must be enabled on both the client and server sides问题及解决的更多相关文章
- 解决Eclipse Failed to write core dump. Minidumps are not enabled by default on client versions
-XX:+CreateMinidumpOnCrash 如果还有问题,就只能看日志了 T_T
- mysql --secure-file-priv is set to NULL.Operations related to importing and exporting data are disabled
--secure-file-priv is set to NULL. Operations related to importing and exporting data are disabledmy ...
- Open Flash Chart IO ERROR Loading test data Error #2032
http://blog.sina.com.cn/s/blog_6754464e0100qfvd.html Open Flash Chart 2 提示Open Flash Chart IO ERROR ...
- 连接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 ...
- 启动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/ ...
- Can’t connect to local MySQL server through socket的解决方法
http://www.aiezu.com/db/mysql_cant_connect_through_socket.html mysql,mysqldump,php连接mysql服务常会提示下面错误: ...
- Entity Framework Tutorial Basics(35):Local Data
Local Data The Local property of DBSet provides simple access to the entities that are currently bei ...
- 解决PowerDesigner提示This data item is already used in a primary identifier
解决PowerDesigner提示This data item is already used in a primary identifier 解决PowerDesigner提示This data i ...
- 转载:Character data is represented incorrectly when the code page of the client computer differs from the code page of the database in SQL Server 2005
https://support.microsoft.com/en-us/kb/904803 Character data is represented incorrectly when the cod ...
- [异常解决] windows用SSH和linux同步文件&linux开启SSH&ssh client 报 algorithm negotiation failed的解决方法之一
1.安装.配置与启动 SSH分客户端openssh-client和openssh-server 如果你只是想登陆别的机器的SSH只需要安装openssh-client(ubuntu有默认安装,如果没有 ...
随机推荐
- c++ Primer Plus 第六版学习记录
立个flag,一天看20页,一个半月看完!!! 第一章 预备知识 高效简洁.面向对象.泛型编程 汇编不具有通用性,换一个处理器可能就要重新写一套! 编译器(是一个程序)负责解决这个问题,把一份高级语言 ...
- 微信小程序跳转重新加载目标页
可用于在首次进入到小程序后就执行性了首页的onLoad方法,等你再去点击其它页面再回来的时候就不会加载onLoad了,比如你跳到登录页后再返回到首页会发现首页啥数据都没加载,所以你在登录那边进行跳转的 ...
- 记一次 .NET某工控视觉自动化系统 卡死分析
一:背景 1. 讲故事 今天分享的dump是训练营里一位学员的,从一个啥也不会到现在分析的有模有样,真的是看他成长起来的,调试技术学会了就是真真实实自己的,话不多说,上windbg说话. 二:WinD ...
- webpack配置图片处理
# 安装 npm i -D url-loader html-loader file-loader # loader配置 module: { rules: [ // 图片处理 { test: /\.(p ...
- 将MP4(视频)转换为MP3(音频)
使用VLC Media Player 步骤1. 在计算机上启动VLC Media Player,点击「媒体」并选择「转换/储存」. 步骤2. 点击「加入」以浏览并打开MP4文件,然后点击「Conver ...
- LINQ to Entities does not recognize the method 'System.String ToString()' method
LINQ to Entities does not recognize the method 'System.String ToString()' method, and this method ca ...
- shiro有哪些组件?
a.Authentication:身份认证/登录,验证用户是不是拥有相应的身份: b.Authorization:授权,即权限验证,验证某个已认证的用户是否拥有某个权限:即判断用户是否能做事情,常见的 ...
- 图片预加载需要token认证的地址处理
1.添加函数修改img的属性: /** * * @param {*} idName 传入的id,获取改img的dom,添加相应的数学 */ export const proxyImg = (idNam ...
- js中字符串的方法,17种方法
字符串的17种方法...... 1.length:返回字符串的长度. const str = "Hello, World!"; console.log(str.length); / ...
- python 发起PUT请求,报"Method not Allowed" 和 取返回的报文的内容
发起请求的时候,默认使用的POST请求方式,导致发起请求,返回[405 Method not Allowed ],检查此更新接口的请求方式为PUT,更改请求方式为PUT PUT接口返回的内容,不能通过 ...