# Installing specific mysql version from deb

**URL:** <https://discuss.circleci.com/t/installing-specific-mysql-version-from-deb/1736>\
**Category:** Bug Reports\
**Tags:** mysql\
**Created:** [January 25, 2016, 10:13pm UTC](https://discuss.circleci.com/t/installing-specific-mysql-version-from-deb/1736 "2016-01-25T22:13:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ahonnecke](https://avatars.discourse-cdn.com/v4/letter/a/73ab20/32.png) [@ahonnecke](https://discuss.circleci.com/u/ahonnecke)\
**Post date:** [January 25, 2016, 10:13pm UTC](https://discuss.circleci.com/t/installing-specific-mysql-version-from-deb/1736/1 "2016-01-25T22:13:08Z")

</div>

I’m trying to install mysql 5.6.28 (not 5.6.14, so [Error installing MySQL 5.6](https://discuss.circleci.com/t/error-installing-mysql-5-6/1240) 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 http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-server_5.6.28-1ubuntu12.04_amd64.deb-bundle.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`

---

<div class="post-metadata">

**Author:** ![alexey](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/alexey/32/42_2.png) [@alexey](https://discuss.circleci.com/u/alexey)\
**Post date:** [February 3, 2016, 10:36pm UTC](https://discuss.circleci.com/t/installing-specific-mysql-version-from-deb/1736/2 "2016-02-03T22:36:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ahonnecke](https://avatars.discourse-cdn.com/v4/letter/a/73ab20/32.png) [@ahonnecke](https://discuss.circleci.com/u/ahonnecke)\
**Post date:** [February 8, 2016, 6:43pm UTC](https://discuss.circleci.com/t/installing-specific-mysql-version-from-deb/1736/3 "2016-02-08T18:43:31Z")

</div>

This is what ended up working:

`#!/bin/bash  
pwd  
set -x  
set -e

export DEBIAN\_FRONTEND=noninteractive

curl -LO [https://dev.mysql.com/get/mysql-apt-config\_0.5.3-1\_all.deb](https://dev.mysql.com/get/mysql-apt-config_0.5.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.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!!"  
pwd`

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [June 18, 2018, 11:33am UTC](https://discuss.circleci.com/t/installing-specific-mysql-version-from-deb/1736/4 "2018-06-18T11:33:56Z")

</div>

Closed on June 18, 2018, 11:33am UTC


