出现的问题
- 导出数据代码
mysql> SELECT * FROM able_name1 INTO OUTFILE '/tmp/runoob.txt' //指定路径
-> FIELDS TERMINATED BY ',' ENCLOSED BY '"'
-> LINES TERMINATED BY '\r\n';
- 导出报错
The MySQL server is running with the --secure-file-priv option
- 查询 secure-file-priv
show global variables like ‘%secure%’;
- 发现 secure-file-priv值为null
(借用的别人的图片,自己操作过程中忘记截图了)
解决步骤
- 打开终端
- 输入以下代码
cd /etc
- 输入以下代码
sudo vim my.cnf
- 输入电脑密码
- 输入a,进入编辑模式
- 复制以下代码输入
# Example MySQL config file for medium systems.
#
# This is for a system with little memory (32M - 64M) where MySQL plays
# an important part, or systems up to 128M where MySQL is used together with