MySQL/Linux:自定义停用词文件 - 权限被拒绝
我正在尝试为 MySQL (5.1.54) 全文索引设置自己的停用词列表,但遇到配置问题。我尝试了以下步骤:
我通过添加行在/etc/mysql/my.cnf中设置了系统变量:
ft_stopword_file = "/home/buli/stopwords.txt"
- 我创建了文件 /home/buli/stopwords.txt > 应该忽略的单词
现在,当我使用sudo service mysql restart重新启动MySQL时,/var/log/mysql/error.log中有一个条目说:
/usr/sbin/mysqld:找不到文件“/home/buli/stopwords.txt”(错误代码:13) 111218 19:07:18 [注意] 事件调度程序:已加载 0 个事件 111218 19:07:18 [注意] /usr/sbin/mysqld:准备连接。
正在运行< em>perror 13 将其翻译为权限被拒绝问题。然而该文件存在,我什至给了它完全权限:
$ ls -l /home/buli/stopwords.txt
-rwxrwxrwx 1 buli buli 6 2011-12-18 18:41 /home/buli/stopwords.txt
是否有任何其他特定于 mysql 的原因导致此错误发生(因为文件权限似乎没问题)?
I'm trying to set my own stopword list for MySQL (5.1.54) fulltext index, but encountered problems with configuration. I tried the following steps:
I did set system variable in /etc/mysql/my.cnf by adding line:
ft_stopword_file = "/home/buli/stopwords.txt"
- I created file /home/buli/stopwords.txt with words that should be ignored
Now when I restart MySQL using sudo service mysql restart there is entry in /var/log/mysql/error.log saying:
/usr/sbin/mysqld: File '/home/buli/stopwords.txt' not found (Errcode: 13) 111218 19:07:18 [Note] Event Scheduler: Loaded 0 events 111218 19:07:18 [Note] /usr/sbin/mysqld: ready for connections.
Running perror 13 translates it as permission denied problem. The file however exists and I even gave it full permissions:
$ ls -l /home/buli/stopwords.txt
-rwxrwxrwx 1 buli buli 6 2011-12-18 18:41 /home/buli/stopwords.txt
Could there be any other, mysql-specific reason for this error to happen (as file permissions seems ok)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您是否在使用 AppArmor、chroot 等来保护它的发行版上运行 MySQL?
对于 AppArmor,您必须更新 /etc/apparmor.d/usr.sbin.mysqld (或类似文件),对于 chroot,您必须复制该文件。
最好的办法是将停用词文件放在数据目录下,并仅给出实际路径。
Are you running MySQL on a distro that uses AppArmor, chroot etc. to secure it?
For AppArmor you have to update /etc/apparmor.d/usr.sbin.mysqld (or similar), for chroot you have to copy the file.
Best thing is to put the stopword file below the data directory and give a realtive path only.
一:切勿授予任何文件 777 权限。
二:问题肯定是运行MySQL的用户无法进入
/home/buli
。如果您需要访问一个文件,您还必须至少拥有通向该文件的所有目录的执行权限(是的,甚至不需要读取权限)。One: NEVER GIVE 777 RIGHTS TO ANY FILE.
Two: the problem is certainly that the user running MySQL cannot enter
/home/buli
. If you need to access a file, you must also have at least the execution permission on all directories leading to that file (yes, read permission is not even needed).