4

I've been Googling and banging my head against this one for quite a while now. I have not installed MySQL on this system before and just installed version 5.6 via MacPorts and have run sudo mysql_install_db following the port installation. I couldn't get the server to start though.

To diagnose the problem, I tried running sudo -u _mysql /opt/local/lib/mysql56/bin/mysqld and get output like...

2013-10-03 21:40:13 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2013-10-03 21:40:13 23189 [Warning] Setting lower_case_table_names=2 because file system for /opt/local/var/db/mysql56/ is case insensitive
2013-10-03 21:40:13 23189 [Note] Plugin 'FEDERATED' is disabled.
/opt/local/lib/mysql56/bin/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13 - Permission denied)
...
2013-10-03 21:40:13 7fff7c8c2180  InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
...

When I run sudo ls -l /opt/local/var/db/mysql56/, I see...

-rw-r--r--   1 root    _mysql         0 Aug  4 15:00 .turd_mysql56-server
-rw-rw----   1 _mysql  _mysql        56 Oct  2 23:09 auto.cnf
-rw-rw----   1 _mysql  _mysql  50331648 Oct  3 22:50 ib_logfile0
-rw-rw----   1 _mysql  _mysql  50331648 Oct  2 23:09 ib_logfile1
-rw-rw----   1 _mysql  _mysql  12582912 Oct  3 00:10 ibdata1
drwx------  81 root    _mysql      2754 Oct  3 00:10 mysql
drwx------  55 root    _mysql      1870 Oct  3 00:10 performance_schema
drwx------   2 root    _mysql        68 Oct  3 00:09 test

When I run sudo ls -l /opt/local/var/db/mysql56/mysql, I see...

...
-rw-rw----  1 root  _mysql    1024 Oct  3 00:09 plugin.MYI
-rw-rw----  1 root  _mysql    8586 Oct  3 00:09 plugin.frm
-rw-rw----  1 root  _mysql       0 Oct  3 00:09 proc.MYD
...

I presume that is what I should see for the file ownership and permissions. Any ideas?

1
  • Is this question more appropriate for here or for S.O.? Oct 4, 2013 at 5:54

2 Answers 2

5

Log in as root and execute:

chown -R _mysql:_mysql /opt/local/var/db/mysql56
1
  • Doh! I thought the group ownership was enough, but didn't notice that the group rw permissions were not present on mysql, performance_schema and test directories (since sudo ls -l /opt/local/var/db/mysql56/ was an afterthought). I suppose this whole problem would not have occurred if i had run sudo -u _mysql mysql_install_db instead of sudo mysql_install_db. Correct? Oct 4, 2013 at 18:58
1

you are running mysql as user _mysql, so _mysql needs to have permission on the database directories

cd /opt/local/var/db/mysql56/mysql
chown -R _mysql mysql performance_schema test
1
  • Also correct, I believe, but of course, I can only accept one answer. Oct 4, 2013 at 18:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .