Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
MySQL/Linux:自定义stopword文件-权限被拒绝_Mysql_Linux_Permissions_Full Text Search - Fatal编程技术网

MySQL/Linux:自定义stopword文件-权限被拒绝

MySQL/Linux:自定义stopword文件-权限被拒绝,mysql,linux,permissions,full-text-search,Mysql,Linux,Permissions,Full Text Search,我正在尝试为MySQL(5.1.54)全文索引设置自己的停止字列表,但遇到了配置问题。我尝试了以下步骤: 我确实在/etc/mysql/my.cnf中通过添加以下行设置了系统变量: ft_stopword_file = "/home/buli/stopwords.txt" 我创建了文件/home/buli/stopwords.txt,其中包含了应该忽略的单词 现在,当我使用sudo服务MySQL restart重新启动MySQL时,/var/log/MySQL/error.log中有一个条目

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

  • 我确实在/etc/mysql/my.cnf中通过添加以下行设置了系统变量:

    ft_stopword_file = "/home/buli/stopwords.txt"
    
  • 我创建了文件/home/buli/stopwords.txt,其中包含了应该忽略的单词
  • 现在,当我使用sudo服务MySQL restart重新启动MySQL时,/var/log/MySQL/error.log中有一个条目说:

  • 运行perror 13将其转换为权限被拒绝问题。但是该文件存在,我甚至授予了它完全权限:

        $ ls -l /home/buli/stopwords.txt
        -rwxrwxrwx 1 buli buli 6 2011-12-18 18:41 /home/buli/stopwords.txt
    

    发生此错误是否还有其他特定于mysql的原因(因为文件权限似乎没有问题)?

    一:永远不要给任何文件授予777权限


    第二:问题当然是运行MySQL的用户不能进入
    /home/buli
    。如果您需要访问某个文件,您还必须至少拥有指向该文件的所有目录的执行权限(是的,甚至不需要读取权限)。

    您是否在使用AppArmor、chroot等保护该文件的发行版上运行MySQL

    对于AppArmor,您必须更新/etc/AppArmor.d/usr.sbin.mysqld(或类似文件),对于chroot,您必须复制文件


    最好的办法是将stopword文件放在数据目录下,并只给出一个实际路径。

    那么
    /home/buli
    呢?它看起来像某人的主目录,因此默认情况下它可能不是公共的。mysql用户无法读取您的主目录。默认情况下,主目录通常为0700。将您的文件移动到更公开的位置,如/opt、/usr/local或/etc。情况似乎就是这样!将stopword文件放入文件中定义的一个目录中,使MySQL加载无误。我甚至不知道阿帕莫。谢谢你的快速回复!我肯定会更仔细地研究unix权限:)将文件移动到更易访问的目录,但这次并没有解决这个问题,AppArmor重新配置解决了这个问题。谢谢你的回复!
    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;