Forked from benlinton/multiple_mysql_versions_for_development.md
Created
March 4, 2020 04:40
-
-
Save Samnan/b506a3fbdc314624d96ac0e5571dd9d2 to your computer and use it in GitHub Desktop.
Revisions
-
benlinton revised this gist
Jun 11, 2019 . 1 changed file with 5 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,10 @@ # Multiple MySQL Versions for Development Options included below: - Using Docker `docker-compose` - Using Homebrew `brew` ## Using Docker (recommended) This gist was originally created for Homebrew before the rise of Docker, yet it may be best to avoid installing mysql via `brew` any longer. Instead consider adding a barebones `docker-compose.yml` for each project and run `docker-compose up` to start each project's mysql service. @@ -35,7 +35,7 @@ To stop your mysql service. docker-compose down # or ctrl-c if service is running in foreground ## Using Homebrew **Disclaimer:** Your milage may vary, I've updated this gist based on comments below but haven't tested it myself since switching to Docker. Please see comments below and/or gist history for additional details. -
benlinton revised this gist
Jun 11, 2019 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ Includes instructions for: - docker-compose - brew (homebrew) ## Option 1: Using Docker (recommended) This gist was originally created for Homebrew before the rise of Docker, yet it may be best to avoid installing mysql via `brew` any longer. Instead consider adding a barebones `docker-compose.yml` for each project and run `docker-compose up` to start each project's mysql service. @@ -35,7 +35,7 @@ To stop your mysql service. docker-compose down # or ctrl-c if service is running in foreground ## Option 2: Using Homebrew **Disclaimer:** Your milage may vary, I've updated this gist based on comments below but haven't tested it myself since switching to Docker. Please see comments below and/or gist history for additional details. -
benlinton revised this gist
Jun 11, 2019 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ Includes instructions for: - docker-compose - brew (homebrew) ## Multiple MySQL Versions using Docker (recommended) This gist was originally created for Homebrew before the rise of Docker, yet it may be best to avoid installing mysql via `brew` any longer. Instead consider adding a barebones `docker-compose.yml` for each project and run `docker-compose up` to start each project's mysql service. @@ -35,7 +35,7 @@ To stop your mysql service. docker-compose down # or ctrl-c if service is running in foreground ## Multiple MySQL Versions using Homebrew **Disclaimer:** Your milage may vary, I've updated this gist based on comments below but haven't tested it myself since switching to Docker. Please see comments below and/or gist history for additional details. -
benlinton revised this gist
Jun 11, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,7 @@ Includes instructions for: ## Using Docker (recommended) This gist was originally created for Homebrew before the rise of Docker, yet it may be best to avoid installing mysql via `brew` any longer. Instead consider adding a barebones `docker-compose.yml` for each project and run `docker-compose up` to start each project's mysql service. **docker-compose.yml** ``` -
benlinton revised this gist
Jun 11, 2019 . 1 changed file with 8 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -27,6 +27,14 @@ volumes: Please visit https://hub.docker.com/_/mysql for environment variables that you can optionally set (e.g. username, password, etc.) To start the your mysql service. docker-compose up To stop your mysql service. docker-compose down # or ctrl-c if service is running in foreground ## Using Homebrew **Disclaimer:** Your milage may vary, I've updated this gist based on comments below but haven't tested it myself since switching to Docker. Please see comments below and/or gist history for additional details. -
benlinton revised this gist
Jun 11, 2019 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,9 @@ # Multiple MySQL Versions for Development Includes instructions for: - docker-compose - brew (homebrew) ## Using Docker (recommended) This gist was created before the rise of Docker, and it may be best to avoid installing mysql via `brew` any more. Instead consider adding a barebones `docker-compose.yml` for each project and run `docker-compose up` to start each project's mysql service. -
benlinton renamed this gist
Jun 11, 2019 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
benlinton revised this gist
Jun 11, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ ## Using Docker (recommended) This gist was created before the rise of Docker, and it may be best to avoid installing mysql via `brew` any more. Instead consider adding a barebones `docker-compose.yml` for each project and run `docker-compose up` to start each project's mysql service. **docker-compose.yml** ``` -
benlinton revised this gist
Jun 11, 2019 . 1 changed file with 29 additions and 26 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,33 @@ # Multiple MySQL Versions for Development ## Using Docker (recommended) This gist was created before the rise of Docker. As an alternative, it may be best to avoid installing mysql via `brew`. Instead add a barebones `docker-compose.yml` for each project and run `docker-compose up` to start each project's mysql service. **docker-compose.yml** ``` version: "3.7" services: db: image: mysql:5.6 restart: always ports: - "3306:3306" volumes: - "db_data:/var/lib/mysql" volumes: db_data: null ``` Please visit https://hub.docker.com/_/mysql for environment variables that you can optionally set (e.g. username, password, etc.) ## Using Homebrew **Disclaimer:** Your milage may vary, I've updated this gist based on comments below but haven't tested it myself since switching to Docker. Please see comments below and/or gist history for additional details. I was using homebrew version 0.9.5 when writing this gist. brew -v # => Homebrew 0.9.5 @@ -50,27 +77,3 @@ To verify which mysql version you're on at any time. # Or using the mysql command mysql --version -
benlinton revised this gist
Jun 11, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -56,7 +56,7 @@ To verify which mysql version you're on at any time. This gist was created before the rise of Docker. As an alternative, it may be best to avoid installing mysql via `brew`. And instead add a barebones `docker-compose.yml` to each project and run `docker-compose up` to start your mysql service. **docker-compose.yml** ``` version: "3.7" services: -
benlinton revised this gist
Jun 11, 2019 . 1 changed file with 30 additions and 20 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ # Multiple MySQL Versions with Homebrew For homebrew version 0.9.5. @@ -9,21 +9,17 @@ Install the current version of mysql. # Install current mysql version brew install mysql # Start agent for current version of mysql brew services start mysql Install the older version of mysql. # Install older mysql version brew install [email protected] # Start agent for older version of mysql brew services stop mysql brew services start mysql56 Then to switch to the older version. @@ -54,13 +50,27 @@ To verify which mysql version you're on at any time. # Or using the mysql command mysql --version # Consider Docker as an Alternative This gist was created before the rise of Docker. As an alternative, it may be best to avoid installing mysql via `brew`. And instead add a barebones `docker-compose.yml` to each project and run `docker-compose up` to start your mysql service. *docker-compose.yml* ``` version: "3.7" services: db: image: mysql:5.6 restart: always ports: - "3306:3306" volumes: - "db_data:/var/lib/mysql" volumes: db_data: null ``` Please visit https://hub.docker.com/_/mysql for environment variables that you can optionally set (e.g. username, password, etc.) -
benlinton revised this gist
Jun 11, 2019 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -19,7 +19,7 @@ Install the older version of mysql. brew search mysql # Install older mysql version brew install [email protected] # Start agent for older version of mysql (including on login) ln -sfv /usr/local/opt/mysql56/*.plist ~/Library/LaunchAgents @@ -34,7 +34,7 @@ Then to switch to the older version. ls /usr/local/Cellar/mysql56 # => 5.6.27 # Link the older version brew switch [email protected] 5.6.27 And to switch back to the current version. -
benlinton revised this gist
Dec 20, 2015 . 1 changed file with 4 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -50,7 +50,10 @@ And to switch back to the current version. To verify which mysql version you're on at any time. # Check which version of mysql is currently symlinked ls -l /usr/local/bin/mysql # => /usr/local/bin/mysql@ -> ../Cellar/mysql56/5.6.27/bin/mysql # Or using the mysql command mysql --version And to unload a mysql agent for a given version. -
benlinton revised this gist
Dec 20, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -52,7 +52,7 @@ To verify which mysql version you're on at any time. # Check which version of mysql is currently symlinked ls -l /usr/local/bin/mysql And to unload a mysql agent for a given version. # Stop agent for current version of mysql launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist -
benlinton revised this gist
Dec 20, 2015 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,9 @@ ## Multiple MySQL Versions with Homebrew For homebrew version 0.9.5. brew -v # => Homebrew 0.9.5 Install the current version of mysql. # Install current mysql version -
benlinton revised this gist
Dec 20, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ ## Multiple MySQL Versions with Homebrew Install the current version of mysql. -
benlinton revised this gist
Dec 20, 2015 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ # Multiple MySQL Versions with Homebrew Install the current version of mysql. # Install current mysql version -
benlinton revised this gist
Dec 20, 2015 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -25,7 +25,7 @@ Then to switch to the older version. brew unlink mysql # Check older mysql version ls /usr/local/Cellar/mysql56 # => 5.6.27 # Link the older version brew switch mysql56 5.6.27 @@ -36,15 +36,15 @@ And to switch back to the current version. brew unlink mysql56 # Check current mysql version ls /usr/local/Cellar/mysql # => 5.7.10 # Link the current version brew switch mysql 5.7.10 To verify which mysql version you're on at any time. # Check which version of mysql is currently symlinked ls -l /usr/local/bin/mysql And if you only want only one version's agent running at a time (database agents/daemons can use a lot of resources). -
benlinton revised this gist
Dec 20, 2015 . 1 changed file with 7 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ Install the current version of mysql. # Install current mysql version brew install mysql # Start agent for current version of mysql (including on login) ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist @@ -15,7 +15,7 @@ Install the older version of mysql. # Install older mysql version brew install homebrew/versions/mysql56 # Start agent for older version of mysql (including on login) ln -sfv /usr/local/opt/mysql56/*.plist ~/Library/LaunchAgents launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql56.plist @@ -24,7 +24,7 @@ Then to switch to the older version. # Unlink current mysql version brew unlink mysql # Check older mysql version ls -la /usr/local/Cellar/mysql56 # => 5.6.27 # Link the older version @@ -41,17 +41,17 @@ And to switch back to the current version. # Link the current version brew switch mysql 5.7.10 To verify which mysql version you're on at any time. # Check which version of mysql is currently symlinked ls -la /usr/local/bin/mysql And if you only want only one version's agent running at a time (database agents/daemons can use a lot of resources). # Stop agent for current version of mysql launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist # Stop agent for older version of mysql launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mysql56.plist rm ~/Library/LaunchAgents/homebrew.mxcl.mysql56.plist -
benlinton revised this gist
Dec 20, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -46,7 +46,7 @@ To verify which version of mysql you're on. # Check which version of mysql is currently symlinked ls -la /usr/local/bin/mysql And if you only want only one version's daemon running at a time. # Stop current version of mysql launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist -
benlinton revised this gist
Dec 20, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -41,7 +41,7 @@ And to switch back to the current version. # Link the current version brew switch mysql 5.7.10 To verify which version of mysql you're on. # Check which version of mysql is currently symlinked ls -la /usr/local/bin/mysql -
benlinton revised this gist
Dec 20, 2015 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -24,6 +24,9 @@ Then to switch to the older version. # Unlink current mysql version brew unlink mysql # Check current mysql version ls -la /usr/local/Cellar/mysql56 # => 5.6.27 # Link the older version brew switch mysql56 5.6.27 -
benlinton revised this gist
Dec 20, 2015 . 1 changed file with 11 additions and 13 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,9 +7,6 @@ Install the current version of mysql. ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist Install the older version of mysql. # Find older mysql versions @@ -22,30 +19,31 @@ Install the older version of mysql. ln -sfv /usr/local/opt/mysql56/*.plist ~/Library/LaunchAgents launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql56.plist Then to switch to the older version. # Unlink current mysql version brew unlink mysql # Link the older version brew switch mysql56 5.6.27 And to switch back to the current version. # Unlink older mysql version brew unlink mysql56 # Check current mysql version ls -la /usr/local/Cellar/mysql # => 5.7.10 # Link the current version brew switch mysql 5.7.10 To check which version you're on. # Check which version of mysql is currently symlinked ls -la /usr/local/bin/mysql And if you only want only one version running at a time. # Stop current version of mysql launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist -
benlinton created this gist
Dec 20, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,56 @@ Install the current version of mysql. # Install current mysql version brew install mysql # Start current version of mysql (including on login) ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist # Check current mysql version ls -la /usr/local/Cellar/mysql Install the older version of mysql. # Find older mysql versions brew search mysql # Install older mysql version brew install homebrew/versions/mysql56 # Start older version of mysql (including on login) ln -sfv /usr/local/opt/mysql56/*.plist ~/Library/LaunchAgents launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql56.plist Then to switch versions. # Unlink current mysql version brew unlink mysql # Link the older version brew link mysql56 Or force the older link (avoid if possible). # To force the link and overwrite all conflicting files brew link --overwrite mysql56 Or use the switch versions command. # To switch versions brew switch mysql56 5.6.27 To double check which version you're on. # Check which version of mysql is currently symlinked ls -la /usr/local/bin/mysql And if you only want one version running at a time. # Stop current version of mysql launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist # Stop older version of mysql launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mysql56.plist rm ~/Library/LaunchAgents/homebrew.mxcl.mysql56.plist