Ugh, seen this error before? I had it from a XAMPP installation where my Mac hard drive had some problems and I had to restore my drive from a time machine backup. When I restored the files, it ends up I could no longer start my mysql database server and for the life of me i could not figure out WTF was going on.
So I did come across a log file in the var/mysql folder that did indicate I had some directory permission issues. Seems during the restore or me manually copying files around, the directory:
was tied to the wrong user account and I believe the httpd.conf dictates some permissions around your folders and who can write to certain folders. Ends up my config (could be coincidence, I won’t claim to be an expert) was pointing to a user nobody yet the folder was my main Mac user (ie ME). So ran a chown command at the terminal prompt:
/Applications/XAMPP/xamppfiles/var/mysql> chown -R nobody mysql
and TaDa, it worked! Back in business and I could use all of my old database configurations. Hopefully this may help you too!