0

I am wanting to install MySQL 5.7 on Ubuntu 20.10 but have not been able to find any tutorials etc on how to do this.

So far I keep trying different approaches based on 20.04 but there doesn't seem to be a simple solution if you are running Groovy.

Is it possible?

Many thanks for any help.

dibs
  • 3,489
  • this works https://superuser.com/a/1501334/276585 replace 19.10 for 20.10. – Rinzwind Jan 11 '21 at 10:31
  • @Rinzwind Via GDebi once I download the .deb I keep trying this one but get in a loop of "Which MySQL product do you wish to configure" - "MySQL Server & Cluster (Currently selected: mysql-5.7)" -> "Which server version do you wish to receive?" - "mysql-5.7" and each time I hit "Next" it goes form one to the other.. I'm guessing I'm missing something obvious here – dibs Jan 11 '21 at 10:50
  • Do you need MySQL to be accessible off the machine, or will it run locally? –  Jan 11 '21 at 11:40
  • @Matigo I am wanting it local – dibs Jan 11 '21 at 20:19

1 Answers1

0

If the goal is to use a previous version of MySQL on a current release of Ubuntu, the two options that I have found to be most reliable are:

  1. Creating a dedicated Virtual Machine for that software
  2. Using a Docker container for that software

The nice thing about Virtual Machines is that they operate just like a regular Ubuntu installation and all of the skills you already know can transfer over just fine. The downside is that they generally require more resources to be dedicated to them.

The nice thing about Docker containers is that you can very quickly set up a specific version of software without first going through the process of obtaining an older Ubuntu ISO and setting everything up.

Here is how you can get MySQL 5.7 running with either option:

Installing MySQL 5.7 on a Virtual Machine

  1. Download and install VirtualBox if you do not already have it on your system
  2. Download the ISO for Ubuntu Server 16.04.7, which uses the MySQL 5.7 release by default (unless you manually override it to use MySQL 8.0)
  3. Create an Ubuntu VM in VirtualBox, ensuring the VM is accessible to the host machine (or the local network)
  4. Install MySQL with:
$ sudo apt update
$ sudp apt install mysql-server
  1. Use the machine

Installing MySQL 5.7 via Docker

First, if you don't already have Docker installed on your system, let's get Docker:

  1. Open a Terminal and ensure the basics are installed:
$ sudo apt update
$ sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
  1. Add Docker's GPG key to your system:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
  1. Add the Docker software repository:
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
  1. Install the Docker Engine:
$ sudo apt-get update
$ sudo apt-get install docker-ce docker-ce-cli containerd.io
  1. Make sure the tool functions by running the "Hello World" container:
$ sudo docker run hello-world

Now that Docker is installed, let's get MySQL 5.7 ...

  1. Pull the MySQL 5.7 container from Docker:
$ sudo docker pull mysql/mysql-server:5.7
  1. Run the container:
sudo docker run –name=mysqlCon -p 3306:3306 -d mysql/mysql-server:5.7

Note: the -p sets the port you wish to communicate on. 3306 is the default for MySQL.

  1. Get the default root password for the MySQL server:
sudo docker logs mysqlCon

You'll see a line that looks like:

[Entrypoint] GENERATED ROOT PASSWORD {password}

Docker Log — MySQL Password

  1. Connect to the MySQL instance on Docker:
sudo docker exec -it mysqlCon mysql -uroot -p

Note: The above command will SSH into the container and run the mysql command. You'll be asked for the generated password.

  1. Set your own password:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'CorrectHorseBatteryStaple';

Be sure to set a proper password for your installation.

  1. Start using MySQL.

This looks like a lot of steps but, once you see the flexibility of using VMs or Docker containers to work with very specific versions of software, you'll wonder how you ever did without.

Hope this gives you what you need.