shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied

shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission deniedの部分を直します。

% sudo -u _mysql /opt/local/lib/mysql56/bin/mysql_install_db
Password:
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
Installing MySQL system tables...shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
2015-05-24 23:34:42 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-05-24 23:34:42 0 [Note] /opt/local/lib/mysql56/bin/mysqld (mysqld 5.6.24) starting as process 46656 ...
2015-05-24 23:34:42 46656 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-05-24 23:34:42 46656 [Note] InnoDB: The InnoDB memory heap is disabled
2015-05-24 23:34:42 46656 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-05-24 23:34:42 46656 [Note] InnoDB: Memory barrier is not used
2015-05-24 23:34:42 46656 [Note] InnoDB: Compressed tables use zlib 1.2.8
2015-05-24 23:34:42 46656 [Note] InnoDB: Using CPU crc32 instructions
2015-05-24 23:34:42 46656 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-05-24 23:34:42 46656 [Note] InnoDB: Completed initialization of buffer pool
2015-05-24 23:34:42 46656 [Note] InnoDB: Highest supported file format is Barracuda.
2015-05-24 23:34:42 46656 [Note] InnoDB: 128 rollback segment(s) are active.
2015-05-24 23:34:42 46656 [Note] InnoDB: Waiting for purge to start
2015-05-24 23:34:42 46656 [Note] InnoDB: 5.6.24 started; log sequence number 5864777
2015-05-24 23:34:42 46656 [Note] RSA private key file not found: /opt/local/var/db/mysql56//private_key.pem. Some authentication plugins will not work.
2015-05-24 23:34:42 46656 [Note] RSA public key file not found: /opt/local/var/db/mysql56//public_key.pem. Some authentication plugins will not work.
2015-05-24 23:34:43 46656 [Note] Binlog end
2015-05-24 23:34:43 46656 [Note] InnoDB: FTS optimize thread exiting.
2015-05-24 23:34:43 46656 [Note] InnoDB: Starting shutdown...
2015-05-24 23:34:44 46656 [Note] InnoDB: Shutdown completed; log sequence number 5864787
OK

Filling help tables...shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
2015-05-24 23:34:44 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-05-24 23:34:44 0 [Note] /opt/local/lib/mysql56/bin/mysqld (mysqld 5.6.24) starting as process 46657 ...
2015-05-24 23:34:44 46657 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-05-24 23:34:44 46657 [Note] InnoDB: The InnoDB memory heap is disabled
2015-05-24 23:34:44 46657 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-05-24 23:34:44 46657 [Note] InnoDB: Memory barrier is not used
2015-05-24 23:34:44 46657 [Note] InnoDB: Compressed tables use zlib 1.2.8
2015-05-24 23:34:44 46657 [Note] InnoDB: Using CPU crc32 instructions
2015-05-24 23:34:44 46657 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-05-24 23:34:44 46657 [Note] InnoDB: Completed initialization of buffer pool
2015-05-24 23:34:44 46657 [Note] InnoDB: Highest supported file format is Barracuda.
2015-05-24 23:34:44 46657 [Note] InnoDB: 128 rollback segment(s) are active.
2015-05-24 23:34:44 46657 [Note] InnoDB: Waiting for purge to start
2015-05-24 23:34:44 46657 [Note] InnoDB: 5.6.24 started; log sequence number 5864787
2015-05-24 23:34:44 46657 [Note] RSA private key file not found: /opt/local/var/db/mysql56//private_key.pem. Some authentication plugins will not work.
2015-05-24 23:34:44 46657 [Note] RSA public key file not found: /opt/local/var/db/mysql56//public_key.pem. Some authentication plugins will not work.
2015-05-24 23:34:44 46657 [Note] Binlog end
2015-05-24 23:34:44 46657 [Note] InnoDB: FTS optimize thread exiting.
2015-05-24 23:34:44 46657 [Note] InnoDB: Starting shutdown...
2015-05-24 23:34:45 46657 [Note] InnoDB: Shutdown completed; log sequence number 5864797
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

  /opt/local/lib/mysql56/bin/mysqladmin -u root password 'new-password'
  /opt/local/lib/mysql56/bin/mysqladmin -u root -h interest-marketing-no-MacBook-Air.local password 'new-password'

Alternatively you can run:

  /opt/local/lib/mysql56/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:

  cd /opt/local ; /opt/local/lib/mysql56/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl

  cd mysql-test ; perl mysql-test-run.pl

Please report any problems at http://bugs.mysql.com/

The latest information about MySQL is available on the web at

  http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

WARNING: Found existing config file /opt/local/etc/mysql56/my.cnf on the system.
Because this file might be in use, it was not replaced,
but was used in bootstrap (unless you used --defaults-file)
and when you later start the server.
The new default config file was created as /opt/local/etc/mysql56/my-new.cnf,
please compare it with your file and take the changes you need
// 権限を付与

% sudo chown root:admin /opt/local/var
% sudo chmod 755 /opt/local/var
% sudo chown root:admin /opt/local/var/db
% sudo chmod 755 /opt/local/var/db