MySQL/Linux:自定义停用词文件 - 权限被拒绝

发布于 2024-12-21 19:46:00 字数 830 浏览 1 评论 0原文

我正在尝试为 MySQL (5.1.54) 全文索引设置自己的停用词列表,但遇到配置问题。我尝试了以下步骤:

  1. 我通过添加行在/etc/mysql/my.cnf中设置了系统变量:

    ft_stopword_file = "/home/buli/stopwords.txt"
    
  2. 我创建了文件 /home/buli/stopwords.txt > 应该忽略的单词
  3. 现在,当我使用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:

  1. I did set system variable in /etc/mysql/my.cnf by adding line:

    ft_stopword_file = "/home/buli/stopwords.txt"
    
  2. I created file /home/buli/stopwords.txt with words that should be ignored
  3. 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

何必那么矫情 2024-12-28 19:46:00

您是否在使用 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.

南渊 2024-12-28 19:46:00

一:切勿授予任何文件 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).

不奢求什么 2024-12-28 19:46:00
Step 1. Search my.cnf or my.ini
# whereis my.cnf
or
#mysql --verbose --help | less

Step 2. Edit my.cnf file
#sudo vim /etc/my.cnf

# Add stop word file and file should be exist
ft_stopword_file="/usr/mysql/stop_words.txt"  ## You can give any path where you put your stop file

Step 3-> Restart mysql
#sudo service mysqld  restart

Step 3-> Login my sql
#mysql -u root -p
mysql -> use mydatabase_name;

mysql-> show variables like 'ft_%';

Variable_name            | Value

ft_stopword_file      /usr/mysql/stop_words.txt`enter code here`

Step -> 5 :- Repair full-test table file

 REPAIR TABLE tablename QUICK

mysql-> REPAIR TABLE products QUICK;
Step 1. Search my.cnf or my.ini
# whereis my.cnf
or
#mysql --verbose --help | less

Step 2. Edit my.cnf file
#sudo vim /etc/my.cnf

# Add stop word file and file should be exist
ft_stopword_file="/usr/mysql/stop_words.txt"  ## You can give any path where you put your stop file

Step 3-> Restart mysql
#sudo service mysqld  restart

Step 3-> Login my sql
#mysql -u root -p
mysql -> use mydatabase_name;

mysql-> show variables like 'ft_%';

Variable_name            | Value

ft_stopword_file      /usr/mysql/stop_words.txt`enter code here`

Step -> 5 :- Repair full-test table file

 REPAIR TABLE tablename QUICK

mysql-> REPAIR TABLE products QUICK;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文