MySQL service doesn't start in Catalina OSX

Installed MySQL 8.0.18 from a dmg file downloaded from the official site. The service won't start when manually started from the new Preferences icon added by the installer. Running sudo /usr/local/mysql/support-files/mysql.server start dies with this error message:

Starting MySQL .. ERROR! The server quit without updating PID file

I tried setting file and dir ownership of /usr/local/mysql/ to the _mysql user, and giving write permissions to /usr/local/mysql/data/ as per other answers suggested but that didn't fix the issue.

Edit: Forgot to make clear this is on macOS Catalina, I think this is highly relevant as this version brought revised security policies setting how/if each app can write to disk.


Solution 1:

After hours investigating I found this post from Michael Fraase: https://discourse.brew.sh/t/mysql-8-0-18-on-catalina-wont-run-as-service/6015/2

I just added:

[mysqld]
user=root

to /etc/my.cnf (or where you have your .cnf file) and it solved it (I can not believe it).

Solution 2:

I solved like this:

  1. Remove MySQL completely Watching: https://gist.github.com/vitorbritto/0555879fe4414d18569d

  2. Install MySQL with Download do MySQL community server

https://dev.mysql.com/downloads/mysql/

And Done! Successfully!