Installing specific mysql version from deb

I’m trying to install mysql 5.6.28 (not 5.6.14, so Error installing MySQL 5.6 doesn’t help me). This is on a LAMP stack. I give up on apt-get install (which may have been incorrect) and started attempting to install .deb files.

Unfortunately, When I uninstall mysql and then attempt to install the deb, I get this error:
A data directory ‘/var/lib/mysql’ is present on this system when no MySQL server package is currently installed on the system.

the build was canceled`

Changing to to headless just means that the script bails.

This error seems to persist regardless of if I remove the data directory or not.

dependencies: cache_directories: - mysql-2.6.28 # relative to the build directory pre: - if [[ ! -e mysql-2.6.28/mysql-common_5.6.28-1ubuntu12.04_amd64.deb ]]; then mkdir mysql-2.6.28; cd mysql-2.6.28; wget -O mysql-5.6.deb.tar && tar -xf mysql-5.6.deb.tar && cd ..; fi - sudo apt-get remove --purge mysql-server mysql-client mysql-common - sudo apt-get purge mysql-server-core-5.5 - sudo apt-get purge mysql-client-core-5.5 - rm -rf /var/lib/mysql - sudo dpkg -i mysql-2.6.28/*.deb - pecl install -f memcached-2.0.1

I assume that /var/lib/mysql is not owned by the default user, so you will probably need sudo to remove it completely. Sounds silly, but still—could you please try that out? Thanks.

This is what ended up working:

set -x
set -e

export DEBIAN_FRONTEND=noninteractive

curl -LO
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.6 | 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.5.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 -E apt-get -y install mysql-community-server

echo "Checking installed version…"
mysql -D mysql -e "SELECT version()"
echo "Done!!"