如何将MySQL General_log_file路径设置为Laravel Homestead中的共享文件夹
我正在使用Laravel Homestead,为了目的,我需要快速访问我的Windows共享文件夹中的MySQL general_log_file
。我从此开始:
mysql> SET GLOBAL general_log_file = '/home/vagrant/code/mysql.log';
我还从mySQL设置中删除了secure_file_priv
,现在我得到了:
mysql> SHOW VARIABLES LIKE "secure_file_priv";
+------------------+-------+
| Variable_name | Value |
+------------------+-------+
| secure_file_priv | |
+------------------+-------+
我什至通过这个方法,但是我仍然会遇到此错误:
Can't create/write to file '/home/vagrant/code/mysql.log' (OS errno 13 - Permission denied)
尝试:
mysql> SET GLOBAL general_log = 'ON';
我如何解决这个令人讨厌的问题?
I'm using laravel homestead, and for purposes I need to have quick access to mysql general_log_file
in my windows shared folder. I started with this:
mysql> SET GLOBAL general_log_file = '/home/vagrant/code/mysql.log';
I also removed secure_file_priv
from mysql setting, now I get:
mysql> SHOW VARIABLES LIKE "secure_file_priv";
+------------------+-------+
| Variable_name | Value |
+------------------+-------+
| secure_file_priv | |
+------------------+-------+
I even gave Give Root Privileges to mysql via this method, but I still get this error:
Can't create/write to file '/home/vagrant/code/mysql.log' (OS errno 13 - Permission denied)
while trying:
mysql> SET GLOBAL general_log = 'ON';
any idea how can I solve this irritating problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我知道要检查的两件事可能是原因。我在流浪的环境中经历了这两种情况。
mySQLD
process。的Linux UID无法编写该目录
Linux内核限制了通过Apparmor(Ubuntu或Debian)或Selinux(Centos或Rhel)访问
MySQLD
的路径。报告的错误是权限错误,即使文件权限似乎允许MySQL用户写入该位置。您必须禁用Apparmor/selinux或配置它以允许替代位置。由于您只使用VM,我只是禁用它,除非您想学习如何在非VM环境中进行配置。
PS:
secure_file_priv
与此问题完全无关。该选项仅影响加载数据infile
和select ...进入外file
。I know of two things to check that are likely causes. I've experienced both of these in a vagrant environment.
The directory is not writeable by the Linux uid of the
mysqld
process.The Linux kernel is restricting the paths accessible to
mysqld
through Apparmor (Ubuntu or Debian) or SELinux (CentOS or RHEL). The error reported is a permission error, even if the file permissions appear to allow the mysql user to write to that location. You must either disable the apparmor/selinux or else configure it to allow the alternative location.Since you're only using a VM, I'd just disable it, unless you would like to learn how to configure it in case you need to do that in a non-VM environment.
PS:
secure_file_priv
is totally irrelevant to this issue. That option affects onlyLOAD DATA INFILE
andSELECT ... INTO OUTFILE
.