############### INSTALLING MySQL 5.6 ON UBUNTU 20.04 LTS
start by updating the release
sudo apt-get update && sudo apt-get dist-upgrade
###### Uninstall any existing version of MySQL
check if you have any mysql installed
mysql -version
or
sudo dpkg -l | grep mysql
sudo rm /var/lib/mysql/ -R && sudo rm /etc/mysql/ -R
Automatically uninstall mysql
sudo apt-get autoremove mysql* --purge && sudo apt-get remove apparmor
Download version 5.6.4x from MySQL site
mysql 5.6.48
wget https://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.48-linux-glibc2.12-x86_64.tar.gz
################### Add mysql user group
sudo groupadd mysql
################### Add a user called mysql to the mysql user group
sudo useradd -g mysql mysql
################### Extract it
sudo tar -xvf mysql-5.6.48-linux-glibc2.12-x86_64.tar.gz
################### Move it to /usr/local
sudo mv mysql-5.6.48-linux-glibc2.12-x86_64 /usr/local/
################### Create mysql folder in /usr/local by moving the untarred folder
cd /usr/local && sudo mv mysql-5.6.48-linux-glibc2.12-x86_64 mysql
################### while inside of /usr/local/ set MySql directory owner and user group
cd 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-default.cnf /etc/my.cnf
################### Start mysql
sudo bin/mysqld_safe --user=mysql & sudo cp support-files/mysql.server /etc/init.d/mysql.server
################### Set root user password
sudo bin/mysqladmin -u root password '[your new password]'
################### Add mysql path to the system
sudo ln -s /usr/local/mysql/bin/mysql /usr/local/bin/mysql
sudo reboot
################### 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
sudo reboot
################### Now login using below command, start mysql server if it's not running already
mysql -u root -p
################### if you get the following error below
mysql: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
################### ######### run the following
sudo apt install apt-file
sudo apt apt-file update
sudo apt-file find libncurses.so.5
################### You should see the following results
libncurses5: /lib/x86_64-linux-gnu/libncurses.so.5
libncurses5: /lib/x86_64-linux-gnu/libncurses.so.5.9
################### Install the libncurses5
sudo apt install libncurses5
sudo reboot
################### then FINALLY
################### Now login using below command, start mysql server if it's not running already
mysql -u root -p