Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

How to Install MySQL on Linux?

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

MySQL is an open-source relational database management system that is based on SQL queries. Here, ‘My” represents the name of the co-founder is Michael Widenius’s daughter and “SQL” represents the Structured Query Language. This server is used for data operations like querying, filtering, sorting, grouping, modifying, and joining the tables present in the database. Before learning the queries, we are going to download and install MySQL on Linux. Some of the common features of MySQL are:

  • It is easy to use and free of cost to download.
  • It contains a solid data security layer to protect important data.
  • It is based on client and server architecture.
  • It supports multithreading which makes it more scalable.
  • It is highly flexible and supported by multiple applications.
  • The performance of MySQL is fast, efficient, and reliable.
  • It is compatible with many operating systems like Windows, macOS, Linux, etc.   

Installing MySQL on Linux

For almost every Linux system, the following commands are used to install MySQL:

Step 1: Go to the terminal using Ctrl+Alt+T. Now using the following command to install MySQL(copy and past it in terminal).

sudo apt install mysql-server

Go-to-the-terminal-to-install-MySQL

Then give your password and hit ENTER

Step 2: Press “y” to continue.

Press-y-to-continue

It will take some time to download and install MySQL.

Download-and-install-MySQL

Step 3: To verify the installation or to know the version enter the following commands in your Terminal.

mysql --version

Verify-the-installation

Step 4: Now we will set the VALIDATE PASSWORD component.

sudo mysql_secure_installation

Set-the-validate-password-component

Then press “y” to set the password. Next press “0” for the low-level password or choose as you want to set the password.

Press-y-to-set-the-password

Create a password. Then Re-enter the password, then to continue press “y” s.

Create-a-password

Now the whole setup is done.

Setup-is-complete

Step 5: To get started with MySQL go to the root directory.  

sudo mysql -u root

Let’s create a database using the following command:

create database database_name;

Creating-database

show databases;

View-database

My Personal Notes arrow_drop_up
Last Updated : 16 Jun, 2022
Like Article
Save Article
Similar Reads