Skip to content

Instantly share code, notes, and snippets.

@bradiosd
Last active February 28, 2017 10:36
Show Gist options
  • Save bradiosd/9ea8dc45ff86f8c91dcfeddd2a77db9d to your computer and use it in GitHub Desktop.
Save bradiosd/9ea8dc45ff86f8c91dcfeddd2a77db9d to your computer and use it in GitHub Desktop.
Installing MySQL 5.7 on Travis CI - Updated 28th February 2017
#!/usr/bin/env bash
# Run the following command before this script is run.
# This would normally go in your travis.yml before_install: config.
#
# chmod -x travis-install-mysql-5.7.sh
#
# Install MySQL 5.7.
sudo service mysql stop || echo "mysql not stopped"
sudo stop mysql-5.6 || echo "mysql-5.6 not stopped"
echo mysql-apt-config mysql-apt-config/select-server select mysql-5.7 | sudo debconf-set-selections
wget http://dev.mysql.com/get/mysql-apt-config_0.7.3-1_all.deb
sudo dpkg --install mysql-apt-config_0.7.3-1_all.deb
sudo apt-get update -q
sudo apt-get install -q -y -o Dpkg::Options::=--force-confnew mysql-server
sudo mysql_upgrade
# Reset MySQL 5.7 root user password.
set -x
set -e
sudo service mysql stop || echo "mysql not stopped"
sudo stop mysql-5.6 || echo "mysql-5.6 not stopped"
sudo mysqld_safe --skip-grant-tables &
sleep 4
sudo mysql -e "use mysql; update user set authentication_string=PASSWORD('') where User='root'; update user set plugin='mysql_native_password';FLUSH PRIVILEGES;"
sudo kill -9 `sudo cat /var/lib/mysql/mysqld_safe.pid`
sudo kill -9 `sudo cat /var/run/mysqld/mysqld.pid`
sudo service mysql restart
sleep 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment