Created
November 7, 2017 13:55
-
-
Save athanasius-kircher/2c559a189260ce896fc392cb8f090ef0 to your computer and use it in GitHub Desktop.
Shell script to switch between different local Maria DB Installations
This file contains 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 characters
#!/bin/bash | |
# Creator:Julius Boellmann | |
# Email: jb@converia.de | |
brew_prefix=$(brew --prefix | sed 's#/#\\\/#g') | |
brew_array=("10.1" "latest") | |
found=0 | |
for i in "${brew_array[@]}" | |
do | |
if [[ "$i" == "$1" ]] | |
then | |
found=1 | |
fi | |
done | |
if ! ((found)) | |
then | |
echo "Invalid argument given only following versions are supported: ${brew_array[*]} " | |
exit 1 | |
fi | |
sudo mysql.server stop | |
brew unlink mariadb | |
brew unlink mariadb@10.1 | |
unlink /usr/local/var/mysql | |
if [[ "$1" == "latest" ]] | |
then | |
brew link mariadb | |
else | |
brew link --force "mariadb@$1" | |
fi | |
ln -s "/usr/local/var/mariadb.$1/" /usr/local/var/mysql | |
sudo mysql.server start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Installation routine
Server stop and unlink is only for safety, may not be needed.