i am getting the following error when trying to run mysql through home-brew.

Arshads-MacBook-Air:~ Arshi$ mysql.server start
/usr/local/bin/mysql.server: line 256: my_print_defaults: command not found
/usr/local/bin/mysql.server: line 276: cd: @@HOMEBREW_CELLAR@@/mysql/5.6.21: No such file or directory
Starting MySQL
 ERROR! Couldn't find MySQL server (@@HOMEBREW_CELLAR@@/mysql/5.6.21/bin/mysqld_safe)

**Mysql has been installed.**

Arshads-MacBook-Air:~ Arshi$ brew install mysql
Warning: mysql-5.6.21 already installed

I received some warning messages when installing homebrew, but according to me it is because i already had R, mysql work bench, mysqlserver, python already installed on the computer

any idea please on how i can get going with running mysql.server through home-brew.Thanks


I think the issue is that you installed mysql without permissions to write my_print_defaults (and possibly other programs) - which get copied to /usr/bin.

Uninstall mysql and reinstall as sudo.

sudo brew uninstall mysql
sudo brew install mysql
  • Arshads-MacBook-Air:~ Arshi$ sudo brew install mysql Error: Cowardly refusing to sudo brew install You can use brew with sudo, but only if the brew executable is owned by root. However, this is both not recommended and completely unsupported so do so at your own risk. Arshads-MacBook-Air:~ Arshi$ – Arshad Islam Nov 9 '14 at 9:28
  • Solved the problem above and reinstalled mysql. Got the following error on start sql. Arshads-MacBook-Air:~ Arshi$ mysql.server start dyld: Library not loaded: @@HOMEBREW_CELLAR@@/openssl/1.0.1j/lib/libcrypto.1.0.0.dylib Referenced from: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib Reason: image not found Starting MySQL . ERROR! The server quit without updating PID file (/usr/local/var/mysql/Arshads-MacBook-Air.local.pid). – Arshad Islam Nov 9 '14 at 9:37

You can fix this by running two things.

which mysql

After you have gotten the part for example /usr/xxxx/sql/that/ then open the bash config

$ sudo nano ~/.bash_profile 

and update the path with the version of mysql you're currently running

alias mysql=/usr/local/opt/mysql@5.7/bin/mysql

This should work fine

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.