首先查看看看那些进程一直在占用
show PROCESSLIST 查询出相关id SELECT concat('KILL ',id,';') FROM information_schema.processlist WHERE user='znyg' and info like "%select round(sum%"; 导出数据保存在txt 当然可以直接导出 SELECT concat('KILL ',id,';') FROM information_schema.processlist WHERE user='znyg' and info like "%select round(sum%" INTO OUTFILE 'G:/temp/student.txt'; 在mysql中执行 mysql>source kill_thread_id.txt
出现错误提示原因是权限问题 错误代码: 1290 The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
通过show variables like ‘%secure%’;查看 secure-file-priv 当前的值是什么
发现secure_file_priv的值为NULL, 导出的数据必须是这个值的指定路径才可以导出,默认是NULL就代表禁止导出
通过mysql的配置文件my.ini可以修改其值。在my.ini文件中添加如下
重启mysql服务,执行show variables like ‘%secure%’;
接下来就可以导出表数据到G:\temp目录的文件中了
SELECT * FROM student INTO OUTFILE ‘G:/tem/student.txt’;