How to install MySQL properly in Linux?

  • Post last modified:December 21, 2020
  • Reading time:3 mins read

MySQL is relational database which is used in most of the programming language

It is very easy to use and implement and use

So we will show you how to install MySQL properly

I’m using Ubuntu pop-os distribution

Install MySQL

We can install MySQL using two methods through CLI. First, we will share you ubuntu repository method

You need to open Linux Terminal and pass commnand

$ sudo apt update

After update now install MySQL

$ sudo apt install mysql-server -y

Installation is completed now you have to setup MySQL server.

$ sudo mysql_secure_installation
install MySQL Linux setup
Setup Password

Now you have to set new password for myql root and confirm the password.

If the password is less than 25 words then press, Yes and many other options will ask you to yes or no. Press yes or y for the rest of the options.

To get login in MySQL pass below command to terminals,it will ask password for MySQL root user.

$ sudo mysql -u root -p
MySQL
MySQL

Before this check wheter mysql is running otherwise you will not able to run mysql.

$ sudo systemctl status mysql.service
MySQL status check
MySQL status check

That’s it for the CLI method you are ready to use, Now we will see how we can install MySQL through the GUI way.

Method 2. Installing MySQL From Official Website

If you prefer installing MySQL through the official website way you can follow step by step Before moving ahead first download the file from the official MySQL website.

Download package through MySQL website
Download package through MySQL website

Click on Download button and new page will open,if you want to register you can else you just click on No thanks,Just download

Copy the link
Copy the link

Read this: How to fix different time issue in Dual Boot?

You can download the file then install but we will use wget to download the file right-click on No thanks, just start my download and copy the link.

$wget https://dev.mysql.com/get/mysql-apt-config_0.8.15-1_all.deb

After downloading install MySQL deb file.

$ sudo dpkg -i mysql-apt-config_0.8.15-1_all.deb 

Now select the distribution name then click on OK after this update the repository.

$ sudo apt update

Rest all the process will be the same as method 1

$ sudo apt install mysql-server -y

You have to set password and few question will asked and you have to just press “y”.

Now MySQL is installed successfully in your system.

Conclusion

This was the basic way to install MySQL in your Linux-based system. In upcoming article will help you with basic usage.

Like what you read? Please share it with others.
guest
0 Comments
Inline Feedbacks
View all comments