Advertisement
Guest User

Untitled

a guest
Jul 27th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. ## Multiple MySQL Versions with Homebrew
  2.  
  3. For homebrew version 0.9.5.
  4.  
  5. brew -v # => Homebrew 0.9.5x
  6.  
  7. Install the current version of mysql.
  8.  
  9. # Install current mysql version
  10. brew install mysql
  11.  
  12. # Start agent for current version of mysql (including on login)
  13. ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
  14. launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
  15.  
  16. Install the older version of mysql.
  17.  
  18. # Find older mysql versions
  19. brew search mysql
  20.  
  21. # Install older mysql version
  22. brew install homebrew/versions/mysql56
  23.  
  24. # Start agent for older version of mysql (including on login)
  25. ln -sfv /usr/local/opt/mysql56/*.plist ~/Library/LaunchAgents
  26. launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql56.plist
  27.  
  28. Then to switch to the older version.
  29.  
  30. # Unlink current mysql version
  31. brew unlink mysql
  32.  
  33. # Check older mysql version
  34. ls /usr/local/Cellar/mysql56 # => 5.6.27
  35.  
  36. # Link the older version
  37. brew switch mysql56 5.6.27
  38.  
  39. And to switch back to the current version.
  40.  
  41. # Unlink older mysql version
  42. brew unlink mysql56
  43.  
  44. # Check current mysql version
  45. ls /usr/local/Cellar/mysql # => 5.7.10
  46.  
  47. # Link the current version
  48. brew switch mysql 5.7.10
  49.  
  50. To verify which mysql version you're on at any time.
  51.  
  52. # Check which version of mysql is currently symlinked
  53. ls -l /usr/local/bin/mysql # => /usr/local/bin/mysql@ -> ../Cellar/mysql56/5.6.27/bin/mysql
  54.  
  55. # Or using the mysql command
  56. mysql --version
  57.  
  58. And to unload a mysql agent for a given version.
  59.  
  60. # Stop agent for current version of mysql
  61. launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
  62. rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
  63.  
  64. # Stop agent for older version of mysql
  65. launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mysql56.plist
  66. rm ~/Library/LaunchAgents/homebrew.mxcl.mysql56.plist
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement