Mysql中secure_file_priv对读写文件的影响

版权声明:JTVDdTRlMGQlNUN1ODk4MSU1Q3U2NDFlJTVDdTRlOGIlNUN1NjBjNSU1Q3UzMDAy https://blog.csdn.net/Jiajiajiang_/article/details/86226884
ERROR 1290 (HY000): The MySQL server is running with the –secure-file-priv option so it cannot execute this statement.

secure_file_priv是用来限制LOAD DATA,SELECT...OUTFILE,and LOAD_FILE()传到哪个指定目录的

  • secure_file_priv的值为null,表示限制mysqld不允许导入/导出
  • secure_file_priv的值为D:/,表示限制mysqld的导入/导出只能发生在D盘目录下
  • secure_file_priv没有具体值时,表示不对mysqld的导入/导出做限制

查看secure_file_priv的值

show global variables like '%secure%';

若是提示没有此参数等信息,需要去配置文件mysql.ini中手工加入此参数。

在sqlmap找到注入点且数据库是mysql时,语言与路径都选择正确,也是DBA权限时,还是无法一键--os-shell时,会报出以下错误

it looks like the file has not been written (usually occurs if the DBMS process user has no write privileges in the destination path)

也是同样的原因,需要在mysql.ini文件中加入

secure_file_priv=D:/

当然,后面的值自己添加,看你需要哪个路径

修改后需要重启mysql服务。

猜你喜欢

转载自blog.csdn.net/Jiajiajiang_/article/details/86226884