MySQL won’t start in MAMP server

macmac-osxmampMySQL

I had MAMP successfully running in one of the user, but since I have created a new user to separate things between two developers, its throwing tantrums.
I am pretty new to Mac itself but managed to find users with similar problems.

In my old user, Apache doesn't start and in the new user, MySql doesn't start.
I have also verified that no other instance of mysqld is running, still it won't run MySql on my system.
I have already restarted the system several times, even checked /etc for the file my.cnf, but there's no my.cnf inside /etc

Couldn't find any form to ask for a support on mamp.info and am desperately missing my Ubuntu now 🙁

Here's the mysql log:

110803 16:16:26 [Note] Plugin 'FEDERATED' is disabled.
110803 16:16:26 [Note] Plugin 'ndbcluster' is disabled.
/Applications/MAMP/Library/libexec/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
110803 16:16:26 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
110803 16:16:26  InnoDB: Started; log sequence number 0 396676924
110803 16:16:26 [ERROR] /Applications/MAMP/Library/libexec/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
110803 16:16:26 [ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: './mysql/host.frm' (errno: 13)
110803 16:16:26 mysqld_safe mysqld from pid file /Applications/MAMP/tmp/mysql/mysql.pid ended

What can be the problem?

Best Answer

This issue is related to the current user not having permissions to the file ./mysql/host.frm (/Applications/MAMP/db/mysql/mysql/host.frm)

Presumably it is because it was installed by a different user, and all files are owned by that user and write permissions are only set up for the files' owner.

In a typical MAMP installation the ownership is likely set to olduser and the admin group (olduser:admin), with only user read/write permissions. If newuser is also in the admin group then just add group read and write to the entire MAMP path:

sudo chmod -R ug+rw /Applications/MAMP

If, like in my case, the company laptop was passed from one user to the other (i.e. olduser won't be using it any more), then it might be a good idea to also change the ownership of all the files:

sudo chown -R newuser:admin /Applications/MAMP

Sidenote:

I know this is an old thread, but since it popped up now that I experienced the same issue, I figured I'd add the full solution to my own problem. Also womble's answer provided helpful insight to the root of the error.