Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Upgrade MySQL without prompt
#!/usr/bin/env bash
wget http://dev.mysql.com/get/mysql-apt-config_0.8.2-1_all.deb
debconf-set-selections <<< 'mysql-apt-config mysql-apt-config/select-tools select MySQL Server (Currently selected: mysql-5.7)'
debconf-set-selections <<< "mysql-apt-config mysql-apt-config/select-preview select mysql-5.7"
debconf-set-selections <<< "mysql-apt-config mysql-apt-config/select-server select mysql-5.7"
debconf-set-selections <<< "mysql-apt-config mysql-apt-config/select-product select Ok"
debconf-set-selections <<< 'mysql-server mysql-server/root_password password root'
debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root'
debconf-set-selections <<< 'mysql-community-server mysql-community-server/root-pass password root'
debconf-set-selections <<< 'mysql-community-server mysql-community-server/re-root-pass password root'
DEBIAN_FRONTEND=noninteractive dpkg -i mysql-apt-config_0.8.2-1_all.deb
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get -y install mysql-server
sudo mysql_upgrade -u root -p
sudo service mysql restart
@soubrunorocha
Copy link

soubrunorocha commented May 26, 2018

Thanks for the script

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment