Skip to content

Instantly share code, notes, and snippets.

@ginokent
Last active April 29, 2021 05:50
Show Gist options
  • Save ginokent/963a92effe33af0af1274fd21c349cb8 to your computer and use it in GitHub Desktop.
Save ginokent/963a92effe33af0af1274fd21c349cb8 to your computer and use it in GitHub Desktop.
MySQL 5.6 on Ubuntu 16.04
#!/bin/bash
# MySQL 5.6 client libraries
# https://launchpad.net/ubuntu/xenial/amd64/libmysqlclient-dev/5.6.28-1ubuntu3
# https://launchpad.net/ubuntu/xenial/amd64/mysql-client-5.6/5.6.28-1ubuntu3
# https://launchpad.net/ubuntu/xenial/amd64/mysql-client-core-5.6/5.6.28-1ubuntu3
# https://launchpad.net/ubuntu/xenial/amd64/mysql-common/5.6.28-1ubuntu3
# https://launchpad.net/ubuntu/xenial/amd64/libmysqlclient18/5.6.28-1ubuntu3
# DEPRECATED https://launchpad.net/ubuntu/xenial/amd64/libdbd-mysql-perl/4.033-1
URLS=$(cat <<'URLS'
http://launchpadlibrarian.net/247512870/libmysqlclient-dev_5.6.28-1ubuntu3_amd64.deb
http://launchpadlibrarian.net/247512887/mysql-client-5.6_5.6.28-1ubuntu3_amd64.deb
http://launchpadlibrarian.net/247512888/mysql-client-core-5.6_5.6.28-1ubuntu3_amd64.deb
http://launchpadlibrarian.net/247512877/mysql-common_5.6.28-1ubuntu3_all.deb
http://launchpadlibrarian.net/247512886/libmysqlclient18_5.6.28-1ubuntu3_amd64.deb
URLS
)
FILENAMES=$(echo "${URLS}" | xargs -I{} basename {} | sed 's@^@/tmp/@')
outputlog() {
printf '##\n# %s\n##\n' "$(echo "$*" | tr '\n' ' ')"
}
outputlog "Purge MySQL 5.7"
apt-get -y purge $(dpkg -l | grep -E "mysql.*5.7" | awk '$0=$2')
(
cd /tmp
outputlog "Download files from urls"
echo "${URLS}" | xargs -t -P 10 -I{} curl -LORsS {}
outputlog "Run: apt-get -y --allow-downgrades install ${FILENAMES}"
apt-get -y --allow-downgrades install ${FILENAMES}
)
outputlog "Run: dpkg -l | grep -i mysql"
dpkg -l | grep -i mysql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment