How install mysql 5.6 in ubuntu 18.04 using terminal?

Linux supports a number of different solutions for installing MySQL. We recommend that you use one of the distributions from Oracle, for which several methods for installation are available:

As an alternative, you can use the package manager on your system to automatically download and install MySQL with packages from the native software repositories of your Linux distribution. These native packages are often several versions behind the currently available release. You are also normally unable to install development milestone releases (DMRs), as these are not usually made available in the native repositories. For more information on using the native package installers, see Section 2.5.7, “Installing MySQL on Linux from the Native Software Repositories”.

Note

For many Linux installations, you may want to set up MySQL to be started automatically when your machine starts. Many of the native package installations perform this operation for you, but for source, binary and RPM solutions you may need to set this up separately. The required script, mysql.server, can be found in the support-files directory under the MySQL installation directory or in a MySQL source tree. You can install it as /etc/init.d/mysql for automatic MySQL startup and shutdown. See Section 4.3.3, “mysql.server — MySQL Server Startup Script”.


What are the steps to install MySQL 5.6 on Ubuntu 18.04 or 20.04 system?

I know that MySQL 5.6 version is not available in 18.04 and 20.04 apt repos. Any other way to install this particular version?

Rick James

70.6k4 gold badges40 silver badges97 bronze badges

asked Apr 27, 2021 at 8:25

How install mysql 5.6 in ubuntu 18.04 using terminal?

2

Answers left in comments:

If you are comfortable with Docker, that would be the fastest solution. You can spin up a container with MySQL 5.6 quite easily and not have to worry that an OS update will b0rk the SQL installation. - matigo

MySQL 5.6 is outdated and not longer supported. So you should think about if 5.7 or MariaDB would work for you as their are compatible in most cases. - nbk

You could use a source code install - it's quite easy if you carefully follow the instructions. - Vérace

I'm using packer to install MySQL 5.6 on an Ubuntu VM. To install it, I'm using the below script.

#!/bin/bash
sudo add-apt-repository 'deb http://kr.archive.ubuntu.com/ubuntu xenial main' -y
sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu trusty universe' -y
sudo apt-get update -y
sudo apt-get install mysql-server-5.6 -y
systemctl restart mysql

However, the installer kept prompting for a password. Is there any way to pass the password in the script since it's installed within a VM? I'm stuck in this situation.

error-screenshot

asked Jun 26, 2021 at 13:02

How install mysql 5.6 in ubuntu 18.04 using terminal?

3

How install mysql 5.6 in ubuntu 18.04 using terminal?
How to install Mysql 5.6 on Ubuntu 20.04 LTS

MySQL is one of the most popular open-source RDMS (relational database management system) which is easy to use, fast, scalable, and an integral part of the popular LEMP and LAMP stacks.


In this tutorial, we will show you how to install and secure MySQL 5.6 on Ubuntu 20.04 LTS Operating System.

  • Prerequisites:-
  • How install MySQL 5.6 in Ubuntu 20.04 using terminal?
  • Practical Video is Available on YouTube
    • Also Read:-

Prerequisites:-

  • Access to a terminal (Ctrl + Alt + T)
  • Network connection
  • A system running with Ubuntu 20.04 LTS
  • A user account with sudo privileges


Also Read:- How to install MySQL 5.5 on Ubuntu 20.04 LTS.

Also Read:- Uninstall or Remove MySql 5.7 from Ubuntu 20.04 LTS.

How install MySQL 5.6 in Ubuntu 20.04 using terminal?

Step1:- First of all you have to add a repository in  /etc/apt/sources. list .

Below are the step by step commands that you have to follow for installing MySql 5.6 server.


sudo add-apt-repository ‘deb http://kr.archive.ubuntu.com/ubuntu xenial main’

Note:– if above repository is not working then use below the repo 


sudo add-apt-repository ‘deb http://archive.ubuntu.com/ubuntu trusty universe’

Step2:- Now Update the repository from below command


sudo apt update

Step3:- Install mysql 5.6 server


sudo apt-get install mysql-server-5.6

Step4:- Create a mysql.sock file


sudo touch /var/run/mysqld/mysql.sock

Step5:- Give ownership to mysqld file


sudo chown mysql:mysql /var/run/mysqld

Step6:- Stop mysql service


sudo /etc/init.d/mysql stop

Step7:- Stat mysql service


sudo /etc/init.d/mysql start

Step8:- Check status of mysql service


sudo service mysql status

Step9:- Login to mysql 5.6 server


mysql -u root -p

Step10. Check MySQL Version

mysql –version

OR

mysql -V

Practical Video is Available on YouTube


* How to install MySQL 5.6 on Ubuntu 18.04 LTS

Also Read:-

* How to install MySQL 5.5 on Ubuntu 20.04 LTS.
* Uninstall or Remove MySql 5.7 from Ubuntu 20.04 LTS.


Conclusion:

That’s it you have successfully installed MySQL 5.6 on Ubuntu 20.04 LTS Operating System.
Let us know if you are facing any issue while installing in the below comment box. We will happy to assist you.

Please feel free to contact us.

How install MySQL in Ubuntu 18.04 using terminal ask Ubuntu?

How to Install MySQL on Ubuntu 18.04.
Prerequisites. The operating system running Ubuntu 18.04 Linux. ... .
Update Local Repositories. Updating the local package with apt-get command. ... .
Install MySQL 5.7 Server. ... .
Verify MySQL 5.7. ... .
Managing the MySQL Process. ... .
Configure MySQL Server..

How do I install a specific version of MySQL in Ubuntu?

It start with adding APT repository with packages for MySQL then dives to the actual package installations and configurations..
Step 1: Add MySQL APT repository in Ubuntu. ... .
Step 2: Update MySQL Repository on Ubuntu. ... .
Step 3: Install MySQL 5.7 on Ubuntu 20.04 Linux machine. ... .
Step 4: Secure MySQL 5.7 Installation on Ubuntu 20.04..

How do I download MySQL from Ubuntu terminal?

Install MySQL on Ubuntu 20.04.
Open the terminal and run the following command: sudo apt update..
Enter your password and wait for the update to finish..
Next, run: sudo apt upgrade..
Enter Y when prompted to continue with the upgrade and hit ENTER. Wait for the upgrade to finish..

How do I install MySQL from the command line?

Execute the following command in the cmd path of bin in mysql extracted path(i.e. in the path C:Users\Username\Documents\mysql\bin>)..
Download the archive zipfile from given below directory. Download directory..
unzip the file..
Rename it with 'mysql' (for ease of use of the folder in later steps)..