phpstudy的mysql设置secure-file-priv实现into outfile
phpstudy内置的mysql设置secure-file-priv
phpstudy内置的mysql在设置secure-file-priv与单版的mysql设置有些许不同,但是总归起来都是在my.ini
配置文件中进行添加secure-file-priv
进行设置,但是该文件路径有时候不同于单版的mysql。
步骤一:my.ini
文件定位
- 一般位于phpstudy安装目录以下路径;例如
D:\phpstudy_pro\Extensions\MySQL5.7.26\my.ini
- 如果实在懒得进行找,直接在phpstudy安装目录进行搜索;例如:
步骤二:在my.ini
文件中添加secure-file-priv路径
- 我在phpstudy安装目录新建了outfile文件夹,来存放外部文件,当然,你想存放在哪个路径都行,根据自己的习惯来。
- 注意:
写入my.ini
的路径格式:D:/phpstudy_pro/outfile
window上复制下来的路径格式:D:\phpstudy_pro\outfile
- 一个是斜杠,另一个是反斜杠,此处注意,添加错误会导致mysql数据库无法启动
- 打开
my.ini
文件添加:secure-file-priv="D:/phpstudy_pro/outfile"
步骤三:验证secure-file-priv路径添加成功与否
- 连接数据库查询:
show variables like '%secure%'
- 查询如图示即视为添加成功
- 然后重启phpstudy即可
总结:
phpstudy内置的mysql在设置secure-file-priv与单版的mysql设置有些许不同,但是总归起来都是在my.ini
配置文件中进行添加secure-file-priv
进行设置。