Can't create PID file on MySQL server, permission denied
The permission errors are because you have the directory set to the Octal Permission 0751. This means the User can read write and execute but everyone else can't. Since you aren't the user _mysql you don't have permissions. You can do two things to fix this.
You could start it by putting sudo in front of the command you use to start the mysqld service.
sudo service mysqld start
You could set the permissions recursively to 0771. This will allow the wheel (administrator) group to write to the directory.
Related videos on Youtube
James Barnhill
Updated on September 18, 2022Comments
-
James Barnhill over 1 year
The MySQL server won't start and is reporting the following error:
/usr/local/mysql/bin/mysqld: Can't create/write to file '/usr/local/mysql/data/James-Barnhills-Mac-Pro.local.pid' (Errcode: 13)
Can't start server: can't create PID file: Permission deniedAll the permissions are set recursively as:
lrwxr-xr-x 1 _mysql wheel 27 Nov 22 09:25 mysql -> mysql-5.5.18-osx10.6-x86_64
but it won't start. I've tried reinstalling several times to no avail.
I'm running as root on Mac OS, and MySQL has read, write, and execute permissions on the "data" folder.
-
Admin over 12 years
ls -ld /usr/local/mysql/data/
? -
Admin over 12 years
drwxr-xr-x 13 _mysql wheel 442 Nov 24 09:04 mysql/data/
-
Admin over 12 years
ls -ld /usr/local/mysql-5.5.18-osx10.6-x86_64/
? -
Admin over 12 years@JamesBarnhill To expand on my earlier comment, make sure
_mysql
hasx
permissions to/usr/local/mysql-5.5.18-osx10.6-x86_64/
, not just/usr/local/mysql
as that is just a symlink. If youchmod +x /usr/local/mysql-5.5.18-osx10.6-x86_64/
it should start (at least that would match the working perms on my MBP). -
Admin over 12 yearsI resolved this issue by running
sudo chmod -R 0771 /usr/local/mysql-*
, giving/usr/local/mysql-5.5.18-osx10.6-x86_64/
the permissionsdrwxrwx--x 18 _mysql wheel
. -
Admin over 2 yearsReferenced in Stack Overflow question MySQL server startup error 'The server quit without updating PID file'.
-
-
James Barnhill over 12 yearsI'm am already running the command
mysqld_safe
as root. Permissions set to 0771, I ran the command again; still the same error code, reverted permissions back.