4

I asked this question on the MySQL forums and got no answer, so I'll try here.

I recently successfully installed the 64 bit version of mysql-5.5.8 on a MacBook Pro in the /usr/local directory.

To address a completely unrelated software (RVM actually) , I chown-ed my /usr/local directory to $USER, Which made MySQL unhappy. It complained specifically about the /usr/local/mysql/data directory, so I chown-ed that directory to _mysql:wheel.

Everything appears to work again, but it made me wonder if I would have been better off changing the owner of the whole /usr/local/mysql directory, not just the data sub-directory.

Since I neglected to make notes of what owner the default installation runs under, could someone tell me what owner and permissions the /usr/local/mysql directory is by default if you don't inadvertently screw it up? :-/

I'm guessing rwxr-xr-x would be appropriate for permissions (that's what the data directory currently has and it appears to be working fine), but reinforcement for that hunch would be appreciated.

Shashanth
  • 4,995
  • 7
  • 41
  • 51
user209835
  • 161
  • 2
  • 11
  • 2
    Would make more sense to move this to serverfault. – Eric Petroelje Jan 24 '11 at 21:41
  • I'm not sophisticated enough with StackOverflow to know how to move a question. Can you tell me how to do that? – user209835 Jan 27 '11 at 03:18
  • I know it is old. I just had the same issue when trying to install Hombrew. So I took a look at the TimeMachine backup and I think these will set up the folders as the original installation: **sudo chown -R root:wheel /usr/local/mysql** and **sudo chown -R _mysql:wheel /usr/local/mysql/data** – gt10001 May 22 '13 at 05:01

2 Answers2

3

I had a similar problem where, in correcting a permissions issue with /user/local, I was no longer able to see any of my databases.

This fixed it:

which mysql

Which returned

$ /usr/local/mysql/bin/mysql

I then changed into the root mysql directory and reset the ownership:

cd /usr/local/mysql
sudo chown -R mysql .
sudo chgrp -R mysql .

After restarting mysql, my databases were back.

Documentation: https://dev.mysql.com/doc/refman/5.6/en/data-directory-initialization.html

James
  • 69
  • 1
  • 8
0

I don't have Mac and never use one but I can give you some hints.

In the config file my.cnf you can find such line in section [mysqld]:

user            = mysql

It should give you information about server user name and these user should be owner of all data files.

If you need some other user have access to that files you can use SGID. In short it allows you to setup some common groups between users and allows you to create files with proper permissions.

More about that you can find here: http://www.library.yale.edu/wsg/docs/permissions/sgid.htm.

Lukasz Stelmach
  • 5,281
  • 4
  • 25
  • 29
  • Thank you for your time, and for the link to that interesting article Lukasz. Can someone with MySQL running locally on a Mac, installed in /usr/local, and who did NOT do something dumb with chown, tell me what user MySQL runs under? Thanks for any help here. – user209835 Jan 27 '11 at 03:16