Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Using the configuration file my.cnf, I've set mysql to run as a different user. It works fine, only every time I restart the daemon it changes ownership of the mysql data directory to mysql.mysql and removes write permissions for the group. The end result is it runs as a different user unable to write to its own data.

Does anybody understand what's going on here? Is this a mysql bug? A fedora issue? Am I doing it wrong?

share|improve this question
1  
I don't have a Fedora box handy. Is there an /etc/sysconfig/mysql(d) that might tell the /etc/rc.d/init.d/mysqld script to enforce ownership on the data directories to mysql:mysql? –  Kyle Smith Jul 3 '11 at 13:49

2 Answers 2

up vote 1 down vote accepted

Fedora's (and RHEL/CentOS) MySQL init script (/etc/init.d/mysql) changes ownership and permissions of the data directory on startup.

You can open the file and comment out the lines you don't need, but then you should be careful when you update your MySQL package, because your changes may be overwritten.

share|improve this answer
    
That's very strange. Do you think I'm the first person running into this problem? What do other people do if they want to easily copy paste data directories as an ordinary user? –  Michael Clerx Jul 3 '11 at 14:16
    
Maybe set up and use sudo? Or just remember to edit /etc/init.d/mysql every time when you update the mysql-server package. –  Vladimir Blaskov Jul 3 '11 at 14:51

If you run mysql as a different user to be able to copy the data from the ordinary user, consider adding this user to group mysql' and leave mysql running asmysql.mysql'.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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