1

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)?

2
  • What about /home/buli? It looks like someone's home directory so it's probably not public by default. Dec 18, 2011 at 18:41
  • The mysql user cannot read into your home directory. By default, home directories are generally 0700. Move your file to a more public spot, like /opt, /usr/local or /etc. Dec 18, 2011 at 18:42

3 Answers 3

2

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.

1
  • 1
    This seems to be the case! Putting stopword file into one of directories defined in the file made MySQL load without errors. I wasn't even aware of AppArmor. Thanks for a quick reply! Dec 18, 2011 at 19:03
0

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).

1
  • I'll definitely look more carefully into unix permissions :) Moving file to more accessible directories however didn't solve the case this time, AppArmor reconfiguration did. Thanks for a reply! Dec 18, 2011 at 19:09
0
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;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.