Homebrew-core: Latest MariaDB Fails To Start

Created on 18 May 2016  路  16Comments  路  Source: Homebrew/homebrew-core

Bug reports:

Fresh install of Homebrew. Install mariadb. Run brew services start mariadb. Unable to connect to MariaDB. brew doctor does not report any problems. LaunchAgent appears correctly installed.

Most helpful comment

FWIW in case anyone finds this down the road (future me included 馃槉), the thing that seems to reliably work for me when trying to switch between MariaDB and MySQL is to delete/rename/backup /usr/local/var/mysql before switching to the other database.

It seems like the installer notices those files and tries to preserve them, but something in there is not compatible between the two databases.

I can reliably switch whenever I want as long as /usr/local/var/mysql doesn't exist when installing the other DB.

For example, this works every time:

brew services stop mysql
brew uninstall mysql
mv /usr/local/var/mysql /usr/local/var/mysql_bu
brew install mariadb
brew services start mariadb

All 16 comments

Noticed that "group" is admin for the mysqld_safe binary in /usr/local/opt/mariadb/bin.

Added error output to LaunchAgent plist file and this is in file:

/usr/local/opt/mariadb/bin/mysqld_safe: line 144: /usr/local/var/mysql/Taylors-MacBook.attlocal.net.err: Permission denied

That binary is owned by Taylor and group is admin.

Same problem for me, linking MariaDB then unlinking and relinking MySQL also caused MySQL to stop working. Had to recursively change permissions on /usr/local to get things working again but not confident that was necessarily the proper fix.

Yeah, I also had to run sudo chown -R Taylor/staff /usr/local to things to work out of the box.

This was on a fresh laptop so not sure this is expected Homebrew / Maria behavior to have to run this command to get things working.

Linking MariaDB:
image

Changing permissions gets it to run:
image

Unlinking MariaDB then relinking it causes same issues until I fix the permissions:
image

Now even changing the permissions won't allow MariaDB to work properly.

@adamwathan

Chances are the install process of mariadb did not complete successfully because mysql was still linked. Maybe brew update && brew services stop mysql && brew unlink mysql && brew reinstall mariadb could solve your issue

Or else:

  • Is the mysql daemon stopped ?
  • Does /tmp/mysql.sock file really exist ?
  • If so, what are the permissions for /tmp/mysql.sock ?

Hey thanks @lucasmichot ! Still getting the error after unlinking MySQL, reinstalling MariaDB and restarting:

image

MariaDB appears to be "running" according to brew services:

image

/tmp/mysql.sock does not actually exist while MariaDB is running:

image

When I unlink MariaDB and relink and restart MySQL, that file does exist:

image

Anyone have any ideas on this?

Same problem for me, linking MariaDB then unlinking and relinking MySQL also caused MySQL to stop working. Had to recursively change permissions on /usr/local to get things working again but not confident that was necessarily the proper fix.

Yeah, I also had to run sudo chown -R Taylor/staff /usr/local to things to work out of the box.

This was on a fresh laptop so not sure this is expected Homebrew / Maria behavior to have to run this command to get things working.

That's expected behaviour, our installer does that for you.

Don't rely on brew services to see if it is running or not: use ps aux | grep mysql (or the mariadb equivalent). Try to use mysql.server start or mysqld rather than brew services to start it and check the failure output.

We'll accept PRs for this but we're not actively working on it at this time.

FWIW in case anyone finds this down the road (future me included 馃槉), the thing that seems to reliably work for me when trying to switch between MariaDB and MySQL is to delete/rename/backup /usr/local/var/mysql before switching to the other database.

It seems like the installer notices those files and tries to preserve them, but something in there is not compatible between the two databases.

I can reliably switch whenever I want as long as /usr/local/var/mysql doesn't exist when installing the other DB.

For example, this works every time:

brew services stop mysql
brew uninstall mysql
mv /usr/local/var/mysql /usr/local/var/mysql_bu
brew install mariadb
brew services start mariadb

@adamwathan these steps worked. Thanks!

For those who get the mysql.sock not found error. See if mysqld is running.
After updating Valet, all went on a roadtrip to hell. The above made the dev-il go away.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

BluePawDev picture BluePawDev  路  3Comments

jyutzler picture jyutzler  路  4Comments

tglawless picture tglawless  路  3Comments

xeoneux picture xeoneux  路  3Comments

dredmorbius picture dredmorbius  路  3Comments