How To Install MySQL 8 Server On Ubuntu 20.04 / 18.04

We can install MySQL 8 server on ubuntu using repository or source code. We can also download the deb package of MySQL on ubuntu. Let’s see, how to install MySQL 8 on ubuntu.

How To Install MySQL 8 Server On Ubuntu 20.04 /19.10 

Before starting the installation of MySQL, we need to download and install the packages. we will install the wget that will download the package from the internet. Once the package is downloaded, we can use dpkg command to install it.

sudo apt install wget -y
sudo wget https://dev.mysql.com/get/mysql-apt-config_0.8.15-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.15-1_all.deb

Check Out: How To Install PIP3 and Django On Ubuntu 20.04 / 19.10

It will ask you which MySQL product would you like to install. Right now, we will install MySQL server 8. Click on “OK” and “Enter“.

install mysql 8 ubuntu

Once the repository is installed or enabled. you can use the below command to install.

sudo apt install mysql-server

mysql 8 install ubuntu

Press “y” and Enter. it will start the installation. Now, it will you to set the MySQL root password. 

mysql 8 install

Again, it will ask you to confirm the root password then click on “OK”.

Install MySQL 8 Server

Click on “OK” and use the default encryption which is recommended.

how to install mysql 8 using repository

Now it will start the installation. we can check the version using the below command. 

sudo apt policy mysql-server

install mysql 8 ubuntu 18.04

Check Out: How To Install and Configure VSFTPD Server On CentOS 8 / 7

Use the below commands to check the port listening on 3306, enable the MySQL if it’s stopped, and check the status.

sudo apt netstat -tnlp | grep 3306
sudo systemctl enable --now mysql
sudo systemctl status mysql

If everything is OK., try to login with the root user using the below command.

sudo mysql -u root -p

Now we will create a database, select that database, and show all the databases as shown in the below figure.

That’s it.

Share on:

I'm the founder of Curious Viral. I hope this blog will provide you complete information about Linux Technology & I would like to share my technical knowledge with you which I have learned during this period.

Other Posts You May Like...

Leave a comment