13

I installed [email protected] using brew. Below are the comands I ran

brew install [email protected]

sudo chmod -R 777 /usr/local/var/mysql

sudo ln -s /usr/local/Cellar/mysql\@5.6/5.6.41/bin/mysql /usr/local/bin/mysql

sudo cp /usr/local/Cellar/mysql\@5.6/5.6.41/homebrew.mxcl.mysql.plist /Library/LaunchAgents/

sudo chown root /Library/LaunchAgents/homebrew.mxcl.mysql.plist

sudo chmod 600 /Library/LaunchAgents/homebrew.mxcl.mysql.plist

sudo chmod +x /Library/LaunchAgents/homebrew.mxcl.mysql.plist

launchctl load -w /Library/LaunchAgents/homebrew.mxcl.mysql.plist

mysql.server start

sh: mysql.server: command not found

this is the output I am getting. mysql --version is giving output

mysql Ver 14.14 Distrib 5.6.41, for osx10.13 (x86_64) using EditLine wrapper

If I start service via brew its starting

brew services start [email protected]

But when I run mysql -uroot I am getting

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

5
  • 1
    There is NO reason for you to execute all those sudo commands. You are literally breaking your MySQL installation. Just brew install [email protected] then brew services start [email protected] - that's it. All the other commands you're doing in between those two steps is ruining everything. Commented Oct 21, 2018 at 19:59
  • I am getting the following errror that time too.. ERROR! The server quit without updating PID file (/usr/local/var/mysql/Jerrys-MacBook-Air.local.pid) Commented Oct 22, 2018 at 3:40
  • Can you share the output of: (f=/usr/local/var/mysql; until [ "$f" = "/" ]; do ls -lda $f; f=$(dirname $f); done) Commented Oct 22, 2018 at 13:53
  • And, the output of: ls -lda $(/usr/local/bin/mysqld --verbose --help 2>/dev/null | grep -A1 'Default options are read' | tail -1) Commented Oct 22, 2018 at 13:55
  • And, lastly: ps -ef | grep mysqld Commented Oct 22, 2018 at 13:56

2 Answers 2

54

I think you need to start the service as well:

brew services start [email protected]

You can then check so the mysql service is running using:

brew services list

Now try to create symlinks for the mysql package:

brew link --force [email protected]

You might need to add the location to mysql to your path, to find the location of the package:

brew list [email protected]

Then add the location to the bin folder to the end of your ~/.profile or ~/.bash_profile file. For instance:

export PATH=$PATH:/usr/local/Cellar/[email protected]/5.6.41/bin

Then reload the file:

source ~/.bash_profile

Now you should be able to use the mysql and connect to the local running server.

Sign up to request clarification or add additional context in comments.

8 Comments

Error: Formula mysql is not installed.
sorry updated, start should be before the name of the service
I have tried that, it says Formula mysql is not installed, maybe because i installed [email protected] ?
@Jerry - I added some more information that I think will solve your problem.
Creating a symlink fixed mysql command not found on my mojave with [email protected]
|
-2

$ vi ~/.bash_profile

write

PATH=${PATH}:/usr/local/mysql/bin

PATH=${PATH}:/usr/local/mysql/support-files

in it. save it.

$ source ~/.bash_profile and then try mysql.server start

2 Comments

You should add some explanation to that code. Why should adding something to the PATH variable solve a socket problem?
The problem is not that the command cannot be found, so the above solution would help very little in this case.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.