5/5 - (1 vote)

Last Updated on August 23, 2022 by Vikash Ekka

How to install MySQL 5.5 on Ubuntu 20.04 LTS | vetechno
How to install MySQL 5.5 on Ubuntu 20.04 LTS | vetechno

Introduction

MySQL is an open-source database management system and free to use. It is commonly installed as part of the most popular LAMP (Linux, Apache, MySQL, PHP/Python/Perl) stack and LEMP (Linux, Nginx, MySQL, PHP) stack.

It uses a relational database and SQL (Structured Query Language) to manage its data. It is the most common software stack that comes up with dynamic websites and web applications.

This tutorial will help to install MySQL 5.5 in Ubuntu 20.04 LTS. In this tutorial what we are doing is that we are just installing MySQL 5.5 manually on Ubuntu desktop or server because Ubuntu has removed its APT repository for MySQL 5.5. and MySQL 5.6. And the same with the Personal Package Archives (PPAs) software repositories. So first we have to download the MySQL package from the official website.

I have tested on Ubuntu 16.04, Ubuntu 18.04 LTS, and Ubuntu 20.04 LTS.

With the same steps below you can also install MySQL 5.6 and MySQL 5.7 only you have to do download the required MySQL packages from the official website .

Let’s begin with our installation.

Prerequisites:-

* Need root user access.
* Internet
* MySQL 5.5 packages.
* Ubuntu 20.04/18.04 LTS 

How install MySQL 5.5 in Ubuntu 20.04 using terminal?

https://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.56-linux-glibc2.5-x86_64.tar.gz

Open Terminal by pressing Crtl + Alt + t and follow the below steps:-

Step1. If you have installed another MySQL then remove it.

sudo apt-get remove –purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean

sudo rm -rf /var/lib/mysql
sudo rm -rf /etc/mysql
sudo apt-get autoremove
sudo apt-get autoclean


Step2.
Delete the MySQL profile (Optional).

sudo rm /etc/mysql/ -R

Step3. Download Mysql 5.5 tar.gz file from the terminal.

wget https://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.56-linux-glibc2.5-x86_64.tar.gz


Step4. Extract the MySQL 5.5 tar.gz file .

sudo tar -xvf mysql-5.5.56-linux-glibc2.5-x86_64.tar.gz

Step5. Now we have to add a MySQL user group.

sudo groupadd mysql

Step6. Add MySQL (not the current user) to the MySQL user group.


sudo useradd -g mysql mysql


Step7.
Move it to /usr/local directory.


sudo mv mysql-5.5.56-linux-glibc2.5-x86_64 /usr/local/

Step8. Rename  the mysql-5.5.56-linux-glibc2.5-x86_64 to mysql.


cd /usr/local

sudo mv mysql-5.5.56-linux-glibc2.5-x86_64 mysql

Step9. Now set Mysql directory ownership and user group .

cd mysql
sudo chown -R mysql:mysql *

Step10. Install the both required lib packages (also work with Mysql 5.6).


sudo apt-get install libaio1
sudo apt-get install libncurses5


Step11.
Execute mysql installation script.

sudo scripts/mysql_install_db –user=mysql

Step12. Set mysql directory ownership from outside the mysql directory.

sudo chown -R root . mysql

Step13. Set data directory ownership from inside mysql directory.

sudo chown -R mysql data


Step14.
Then we have to copy the mysql configuration file.


sudo cp support-files/my-medium.cnf /etc/my.cnf

Step15. Start mysql Services.


sudo bin/mysqld_safe –user=mysql &
sudo cp support-files/mysql.server /etc/init.d/mysql.server

Step16. Set root user password.

sudo bin/mysqladmin -u root password ‘[Enter your new password]’


Step17.
Add MySQL path to the system. This will create symbolic link to execute the mysql service.

sudo ln -s /usr/local/mysql/bin/mysql /usr/local/bin/mysql

Step18. Reboot your server.

Step19. Start mysql server service .

sudo /etc/init.d/mysql.server start

Step20. Stop mysql server service .

sudo /etc/init.d/mysql.server stop

Step21. Now check status of mysql

sudo /etc/init.d/mysql.server status

Step22. Enable mysql on startup

sudo update-rc.d -f mysql.server defaults

Step23.  Disable mysql on startup (Optional)

sudo update-rc.d -f mysql.server remove

Step24. Now you are ready to login MySQL server follow below command.

mysql -u root -p

How to Fix package ‘mysql-server-5.5 has no installation candidate

FIXED:-
Follow the above step to fix or resolve the mysql server has no installation candidate in the Ubuntu system.

How to install MySQL 5.5 on Ubuntu 18.04

Same steps will be followed for mysql 5.5 on Ubuntu 18.04

Conclusion

We have successfully install MySQL 5.5 on ubuntu 20.04 LTS and Ubuntu 18.04 LTS operating system.Let me know in the comment box if you are facing any kind of issue.
We will happy to answer those question.

By Vikash Ekka

Hi All, My name is Vikash Ekka from India. I’m the founder and tech editor of https://www.vetechno.in. I have completed my Graduation in BCA. I love to write technical articles like Windows, Linux & MAC Tutorials, Tips, Tricks, How To fix, Tutorials About Ethical Hacking & Cyber Security Guide, and Software Review. Currently, I have been working as an IT professional since 2018.

8 thoughts on “How to install MySQL 5.5 on Ubuntu 20.04 LTS | vetechno”
  1. $ mysql -u root -p

    mysql: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory

    [solved]
    sudo apt-get install libncurses5

    BTW, Thank's Vikash Ekka for this tutorial.

    Linux Users, from Indonesia.

  2. > mysql: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory

    in my case (kubuntu 20.4) the following command helped to solve this issue:
    ln -s /lib/x86_64-linux-gnu/libncursesw.so.6 /lib/x86_64-linux-gnu/libncursesw.so.5

  3. in the end :

    mysql -u root -p
    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

    1. Fot those who are facing the same problem as me. Check if your mysql.server service is running with
      service –status-all

      No? Then start it manually with
      service mysql.server start

      Try step 24 again

  4. Hello,

    Thanks very much for this tutorial, I’m very new to Ubuntu and all went very well.

    I have a question:

    How do I make sure mysql, php-mysql and the apache dependencies wont upgrade if performing unattended upgrades ??

    At this time I can’t duplicate the server for testing purposes. Do you have any ready to use routine ?

    Thanks a lot
    David

Leave a Reply

Your email address will not be published. Required fields are marked *