Last active
October 6, 2019 01:26
-
-
Save mahemoff/abe3494ed02467a79341a574da090aea to your computer and use it in GitHub Desktop.
circleci mysql upgrade
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 | |
set -x | |
set -e | |
export DEBIAN_FRONTEND=noninteractive | |
sudo apt-get --purge autoremove -y mysql-server-5.6 | |
curl -LO https://dev.mysql.com/get/mysql-apt-config_0.7.3-1_all.deb | |
echo mysql-apt-config mysql-apt-config/select-product select Apply | sudo debconf-set-selections | |
echo mysql-apt-config mysql-apt-config/select-server select mysql-5.7 | sudo debconf-set-selections | |
echo mysql-apt-config mysql-apt-config/select-connector-python select none | sudo debconf-set-selections | |
echo mysql-apt-config mysql-apt-config/select-workbench select none | sudo debconf-set-selections | |
echo mysql-apt-config mysql-apt-config/select-utilities select none | sudo debconf-set-selections | |
echo mysql-apt-config mysql-apt-config/select-connector-odbc select connector-odbc-x.x | sudo debconf-set-selections | |
sudo -E dpkg -i mysql-apt-config_0.7.3-1_all.deb | |
sudo apt-get update | |
echo mysql-community-server mysql-community-server/re-root-pass password ${mysql_root_password} | sudo debconf-set-selections | |
echo mysql-community-server mysql-community-server/root-pass password ${mysql_root_password} | sudo debconf-set-selections | |
#sudo RUNLEVEL=1 -E apt-get -y install mysql-community-server | |
sudo -E apt-get -y install mysql-community-server | |
echo "Checking installed version....." | |
mysql -D mysql -e "SELECT version()" | |
# https://www.sitepoint.com/quick-tip-how-to-permanently-change-sql-mode-in-mysql/ | |
echo 'sql-mode="STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"' | sudo tee -a /etc/mysql/my.cnf | |
sudo service mysql restart | |
echo "Checking sql_mode....." | |
mysql -D mysql -e "show variables like 'sql_mode'" | |
echo "Done!!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Put this in /circle.yml: (the raw gist URL may change if this gist is updated)