I faced this error yesterday as i was working on one of my side projects. I was not able to connect to MySql server. Neither by cli nor by UI tools. After doing some research I found out that this is caused because of some corrupted files on the installed package.

The obvious and shortest way to fix this was reinstalling the setup. Relax, your databases are safe. they wont be removed.

❯ brew doctor

resolve any and all the issues shown by the mentioned command. Ones done proceed to the following command.

❯ brew remove mysql
❯ brew install mysql

After the installation, your setup is ready to roll.

Starting Server

❯ mysql.server start

Accessing MySql Server

❯ mysql -u root