mysql - 如何在 Ubuntu 20.04 上更改 MySQL 中的安全文件私有选项
问题描述
我正在尝试在 Ubuntu 20.04 上使用 OUTFILE 并收到此错误:MySQL 服务器版本:8.0.21
代码:
mysql> select * into OUTFILE '/home/yash/Desktop/data2.txt' from ticket;
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
我尝试了很多解决方案,但在 Ubuntu 20.04 上不起作用
如果有人可以为 Ubuntu 20.04 和 MySQL 8.0.21 提供解决方案,那么将不胜感激。
解决方案
You can use
SHOW VARIABLES LIKE "secure_file_priv";
to see the directory that MySQL thinks that it is secure to load or save files.
You have now two options:
Move your file to the directory specified by secure-file-priv.
Disable secure-file-priv. This must be removed from startup and cannot be modified dynamically. So you have to change it in my.conf
In my.con you should find secure-file-priv=
and change it to
[mysql]
secure-file-priv='/home/yash/Desktop/'
So that your desktop will become a save directory.
And you can disable the secure file option, which is not recommended by
[mysql]
secure-file-priv=''
推荐阅读
- java - 如果在使用 java 的字符串中找不到结束标记,如何转义 html 标记?
- ios - 如何在编译和轻松管理方面最好地管理 Swift Package Manager 依赖项?
- windows - Docker Desktop 不会切换到 Windows 容器(在 Windows 10 上)
- c++ - 调整二维点向量的大小以匹配调整大小的图像?
- ios - 有什么方法可以快速检查从 UIActivityViewController 成功发送的消息吗?
- ios - 如何显示 SwiftUI 视图而不是 UIViewController?
- spring-batch - Spring Batch 和 Spring Cloud 数据流教程
- azure - 如何在导入 Azure 数据工厂时限制/过滤 CSV 文件的源列
- numpy - 将 sum(...) 转换为 numpy
- string - Twig,显示日期时间集合?