Is it possible to install MySQL 5.5 or 5.6 on Ubuntu 16.04?
I recently upgraded to Ubuntu 16.04. Unfortunately I need to work MySQL 5.5 or 5.6. I tried many solutions to have MySQL 5.5 or 5.6 run on Ubuntu 16.04 like this Install MySql 5.6 on Ubuntu 16.04 . But none of them is working. Ubuntu detect the unmet dependencies but says "but it is not going to be installed" for 5.5 or says Package 'mysql-server-5.6' has no installation candidate...
Is it not possible to force an earlier version of MySQL on Ubuntu? Why is that?
Solution 1:
Step by step guide* to install mysql 5.5.x on Ubuntu 16.04 Xenial-Xerus. Please see this documentation
OR
See steps below:
Installing MySQL 5.5.51 on Ubuntu 16.06
-
Uninstall any existing version of MySQL
sudo rm /var/lib/mysql/ -R
-
Delete the MySQL profile
sudo rm /etc/mysql/ -R
-
Automatically uninstall mysql
sudo apt-get autoremove mysql* --purge sudo apt-get remove apparmor
-
Download version 5.5.51 from MySQL site
wget https://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.56-linux-glibc2.5-x86_64.tar.gz
-
Add
mysql
user groupsudo groupadd mysql
-
Add
mysql
(not the current user) tomysql
user groupsudo useradd -g mysql mysql
-
Extract
mysql-5.5.51-linux2.6-x86_64.tar.gz
to/usr/local
cd /usr/local sudo tar -xvf mysql-5.5.49-linux2.6-x86_64.tar.gz
-
Create
mysql
folder in/usr/local
sudo mv mysql-5.5.49-linux2.6-x86_64 mysql
-
Set
mysql
directory owner and user groupcd mysql sudo chown -R mysql:mysql *
-
Install the required lib package
sudo apt-get install libaio1
-
Execute mysql installation script
sudo scripts/mysql_install_db --user=mysql
-
Set mysql directory owner from outside the mysql directory
sudo chown -R root .
-
Set data directory owner from inside mysql directory
sudo chown -R mysql data
-
Copy the mysql configuration file
sudo cp support-files/my-medium.cnf /etc/my.cnf
-
Start mysql
sudo bin/mysqld_safe --user=mysql & sudo cp support-files/mysql.server /etc/init.d/mysql.server
-
Initialize root user password
sudo bin/mysqladmin -u root password '111111'
-
Start mysql server
sudo /etc/init.d/mysql.server start
-
Stop mysql server
sudo /etc/init.d/mysql.server stop
-
Check status of mysql
sudo /etc/init.d/mysql.server status
-
Enable myql on startup
sudo update-rc.d -f mysql.server defaults
-
Disable mysql on startup (Optional)
sudo update-rc.d -f mysql.server remove
-
Add mysql path to the system
sudo ln -s /usr/local/mysql/bin/mysql /usr/local/bin/mysql
-
Now directly use the command below to start mysql
mysql -u root -p
PS: One needs to reboot in order for the changes to take place.
Based on a Chinese blog
Solution 2:
Try this, First you have to remove
sudo rm /var/lib/mysql/debian-5.7.flag
then
sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu trusty universe'
sudo apt-get update
sudo apt install mysql-server-5.6
sudo apt install mysql-client-5.6
Solution 3:
This answer helped me figure out how to do it by downloading the .deb
packages from MySQL dev site. The solution about adding the PPA did not do it for me.
It links to a blogpost: How to Install MySQL-5-6 on Ubuntu Precise Tricky but it works.