Homebrew / homebrew-core

🍻 Default formulae for the missing package manager for macOS (or Linux)
https://brew.sh
BSD 2-Clause "Simplified" License
13.8k stars 12.47k forks source link

Issue with mysql 5.6 after being moved to homebrew-core #7711

Closed kdurski closed 7 years ago

kdurski commented 7 years ago

Please follow the general troubleshooting steps first:

Bug reports:

I have mysql56 (5.6.34), which (I believe) is installed from homebrew/versions tap and set up as service through brew services start mysql56. However it seems this formula it got moved to homebrew/core recently with new name - mysql@5.6 and this is causing a few issues for me - both formulas are installed, only old one is running but neither can be managed by brew-services. Here are some steps to reproduce it:

Some debugging information:

2.0.0 LaunchAgents kamil% brew doctor
Your system is ready to brew.

2.0.0 LaunchAgents kamil% brew config
HOMEBREW_VERSION: 1.1.2
ORIGIN: https://github.com/Homebrew/brew.git
HEAD: 0f529dae1043639058130092cf35e68d18907cb8
Last commit: 11 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: ca994e8461ee517ac68e058a6ff93335c0786599
Core tap last commit: 45 minutes ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local/Homebrew
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: quad-core 64-bit skylake
Homebrew Ruby: 2.0.0-p648
Clang: 8.0 build 800
Git: 2.11.0 => /usr/local/bin/git
Perl: /usr/bin/perl
Python: /usr/local/bin/python => /usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/bin/python2.7
Ruby: /Users/kamil/.rvm/rubies/ruby-2.0.0-p647/bin/ruby
Java: 1.8.0_112
macOS: 10.12.2-x86_64
Xcode: N/A
CLT: 8.1.0.0.1.1476494586
X11: N/A

2.0.0 LaunchAgents kamil% brew services list
Name       Status  User  Plist
httpd24    started root  /Library/LaunchDaemons/homebrew.mxcl.httpd24.plist
kafka      started kamil /Users/kamil/Library/LaunchAgents/homebrew.mxcl.kafka.plist
php54      stopped
postgresql stopped
rabbitmq   started kamil /Users/kamil/Library/LaunchAgents/homebrew.mxcl.rabbitmq.plist
redis      started kamil /Users/kamil/Library/LaunchAgents/homebrew.mxcl.redis.plist
zookeeper  started kamil /Users/kamil/Library/LaunchAgents/homebrew.mxcl.zookeeper.plist

2.0.0 LaunchAgents kamil% brew services cleanup
mysql@5.6       stale => killing service...
Error: Failure while executing: /bin/launchctl remove homebrew.mxcl.mysql@5.6

And running brew upgrade with only mysql56 installed:

2.0.0 LaunchAgents kamil% brew upgrade
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
aws-sdk-cpp                                             awscli                                                  dockviz                                                 filebeat                                                gnutls

==> Upgrading 1 outdated package, with result:
mysql@5.6 5.6.34
==> Upgrading mysql@5.6
==> Downloading https://homebrew.bintray.com/bottles/mysql@5.6-5.6.34.sierra.bottle.tar.gz
Already downloaded: /Users/kamil/Library/Caches/Homebrew/mysql@5.6-5.6.34.sierra.bottle.tar.gz
==> Pouring mysql@5.6-5.6.34.sierra.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/innochecksum
Target /usr/local/bin/innochecksum
is a symlink belonging to mysql56. You can unlink it:
  brew unlink mysql56

To force the link and overwrite all conflicting files:
  brew link --overwrite mysql@5.6

To list all files that would be deleted:
  brew link --overwrite --dry-run mysql@5.6
MikeMcQuaid commented 7 years ago

I could probably do that but I will loose all mysql data from "old" directory /usr/local/Cellar/mysql56/5.6.34/ since new one will be /usr/local/Cellar/mysql@5.6/5.6.34/

Fear not: all your data is in /usr/local/var and not removed on uninstall.

I am not sure what was the reason for moving a few formulas from versions to core, but it seems that there is no migration and its causing a few issues with this new formula name format. I know I could install new formula, rename the directory under /usr/local/Cellar, remove old formula, old service plist and start service again, but I don't think this is intended.

There is a migration but unfortunately I screwed it up for a (relatively) short window with MySQL 5.6 specifically which you seem to have hit. Your best bet in this case is to:

brew uninstall --force mysql56 mysql@5.6
rm -rf /usr/local/Cellar/mysql@5.6 /usr/local/Cellar/mysql56 ~/Library/LaunchAgents/*mysql56* ~/Library/LaunchAgents/*mysql5@6*
brew prune
brew install mysql@5.6
brew services restart mysql@5.6

Sorry for the inconvenience.

kdurski commented 7 years ago

Thanks, I did what you suggested and its almost working now :) Now I can see only 1 service, its running but brew services cleanup is complaining about it for some reason:

2.0.0 ~ kamil% brew services cleanup
Warning: Service homebrew.mxcl.mysql@5.6 not managed by `brew services` => skipping
All user-space services OK, nothing cleaned...

2.0.0 ~ kamil% brew services list
Name       Status  User  Plist
httpd24    started root  /Library/LaunchDaemons/homebrew.mxcl.httpd24.plist
kafka      started kamil /Users/kamil/Library/LaunchAgents/homebrew.mxcl.kafka.plist
mysql@5.6  started kamil /Users/kamil/Library/LaunchAgents/homebrew.mxcl.mysql@5.6.plist
php54      stopped
postgresql stopped
rabbitmq   started kamil /Users/kamil/Library/LaunchAgents/homebrew.mxcl.rabbitmq.plist
redis      started kamil /Users/kamil/Library/LaunchAgents/homebrew.mxcl.redis.plist
zookeeper  started kamil /Users/kamil/Library/LaunchAgents/homebrew.mxcl.zookeeper.plist
MikeMcQuaid commented 7 years ago

What does ls -lha /Users/kamil/Library/LaunchAgents/homebrew.mxcl.mysql@5.6.plist output? Does brew services cleanup still output that after brew services restart mysql@5.6? If so, could try a stop and start manually.

kdurski commented 7 years ago

Mike,

Yes, it still outputs that error even after full reinstall:

2.0.0 ~ kamil% ls -lha /Users/kamil/Library/LaunchAgents/homebrew.mxcl.mysql@5.6.plist
-rw-------  1 kamil  staff   597B  9 gru 16:44 /Users/kamil/Library/LaunchAgents/homebrew.mxcl.mysql@5.6.plist

2.0.0 ~ kamil% brew services restart mysql@5.6
Stopping `mysql@5.6`... (might take a while)
==> Successfully stopped `mysql@5.6` (label: homebrew.mxcl.mysql@5.6)
==> Successfully started `mysql@5.6` (label: homebrew.mxcl.mysql@5.6)

2.0.0 ~ kamil% brew services cleanup
Warning: Service homebrew.mxcl.mysql@5.6 not managed by `brew services` => skipping
All user-space services OK, nothing cleaned...

2.0.0 ~ kamil% brew services stop mysql@5.6
Stopping `mysql@5.6`... (might take a while)
==> Successfully stopped `mysql@5.6` (label: homebrew.mxcl.mysql@5.6)

2.0.0 ~ kamil% mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

2.0.0 ~ kamil% brew services start mysql@5.6
==> Successfully started `mysql@5.6` (label: homebrew.mxcl.mysql@5.6)

2.0.0 ~ kamil% mysql -u root 
Welcome to the MySQL monitor.  Commands end with ; or \g.

2.0.0 ~ kamil% brew services cleanup
Warning: Service homebrew.mxcl.mysql@5.6 not managed by `brew services` => skipping
All user-space services OK, nothing cleaned...
MikeMcQuaid commented 7 years ago

Try:

brew services stop mysql@5.6
rm -rf /Users/kamil/Library/LaunchAgents/homebrew.mxcl.mysql@5.6.plist
brew services restart mysql@5.6
brew services cleanup
kdurski commented 7 years ago

I'm afraid problem persists :(

travisdetert commented 7 years ago

Seriously, what is going on with brew and specific versions in general? I'm having tons of problems lately. I am also needing specific versions of ansible and I'm having the exact same problems as this thread.