How can I auto start mysqld

I tried following https://stackoverflow.com/q/26476391/631619 but it didn't help

It seems like I have a ownership/permission problem, possibly related to from having installed mysql on this machine for a different user account.

I uninstalled and reinstalled but still get

$ brew install mysql
==> Downloading https://homebrew.bintray.com/bottles/mysql-5.6.27.yosemite.bottle.tar.gz
Already downloaded: /Library/Caches/Homebrew/mysql-5.6.27.yosemite.bottle.tar.gz
==> Pouring mysql-5.6.27.yosemite.bottle.tar.gz
==> Caveats
A "/etc/my.cnf" from another install may interfere with a Homebrew-built
server starting up correctly.

To connect:
    mysql -uroot

To have launchd start mysql at login:
  ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
Then to load mysql now:
  launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
Or, if you don't want/need launchctl, you can just run:
  mysql.server start

WARNING: launchctl will fail when run under tmux.
==> Summary
🍺  /usr/local/Cellar/mysql/5.6.27: 9883 files, 339M
16:55:49 pengo EQ-390 /Users/pengo
$ ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
/Users/pengo/Library/LaunchAgents/homebrew.mxcl.mysql.plist -> /usr/local/opt/mysql/homebrew.mxcl.mysql.plist
16:56:36 pengo EQ-390 /Users/pengo
$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
/usr/local/Cellar/mysql/5.6.27/homebrew.mxcl.mysql.plist: Operation not permitted
$ sudo launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
/usr/local/Cellar/mysql/5.6.27/homebrew.mxcl.mysql.plist: Path had bad ownership/permissions
$ l ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
lrwxr-xr-x  1 pengo  staff  46 Nov  7 16:56 /Users/pengo/Library/LaunchAgents/homebrew.mxcl.mysql.plist@ -> /usr/local/opt/mysql/homebrew.mxcl.mysql.plist

I can start mysqld manually however, ie..

$ mysqld
2015-11-07 17:02:22 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-11-07 17:02:22 0 [Note] mysqld (mysqld 5.6.27) starting as process 21472 ...
2015-11-07 17:02:22 21472 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2015-11-07 17:02:22 21472 [Note] Plugin 'FEDERATED' is disabled.
2015-11-07 17:02:22 21472 [Note] InnoDB: Using atomics to ref count buffer pool pages

and then in another window

$ mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.27 Homebrew

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


Also fyi

$ l /usr/local/bin/mysql
lrwxr-xr-x  1 pengo  admin  32 Nov  7 16:55 /usr/local/bin/mysql@ -> ../Cellar/mysql/5.6.27/bin/mysql

Do I perhaps need to chown whoami for additional files?

I tried adding

export PATH=${PATH}:/usr/local/Cellar/mysql/5.6.27/bin/mysqld

to my .bashrc based on having

$ l /usr/local/Cellar/mysql/5.6.27/bin/mysqld -r-xr-xr-x  1 pengo  admin  
11948736 Nov  7 16:54 /usr/local/Cellar/mysql/5.6.27/bin/mysqld*

but I still got the same errors.

1 Answer 1


Looks like adding the path to to my .bashrc was probably the solution.

export PATH=${PATH}:/usr/local/Cellar/mysql/5.6.27/bin/mysqld

I also need to exit a current mysql session that was open

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .