The Wayback Machine - https://web.archive.org/web/20241008141210/https://www.geeksforgeeks.org/how-to-install-mysql-on-linux/
Open In App

How to Install MySQL on Linux?

Last Updated : 18 Mar, 2024
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

MySQL is an open-source relational database management system that is based on SQL queries. Here, “My” represents the name of the co-founder Michael Widenius’s daughter and “SQL” represents the Structured Query Language. MySQL is used for data operations like querying, filtering, sorting, grouping, modifying, and joining the tables present in the database.

In this article, we will are going to download and install MySQL on Linux and will verify MySQL installation by creating a database. But Before that Let’s see some features of MySQL.

Feature of MySQL

MySQL is the most popular RDBMS, It offers various features like:

  • 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.
  • MySQL is fast, efficient, and reliable.
  • It is compatible with many operating systems like Windows, MacOS, Linux, etc.   

Read more: MySQL and its working

Steps to Install MySQL on Linux

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

Installing MySQL on Linux using Terminal

Step 1: Open terminal using Ctrl+Alt+T. Now copy and paste the following command in the terminal to install MySQL in Linux.

sudo apt install mysql-server

Install-MySQL-on-Linux_1

Then give your password and hit ENTER. 

Step 2: Press “y” to continue.

Install-MySQL-on-Linux_2

It will take some time to download and install MySQL in Linux.

Install-MySQL-on-Linux_3

Verify MySQL Installation

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

mysql --version

Verify-MySQL-Installation_1

Protecting and Securing MySQL

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

sudo mysql_secure_installation

Protecting-and-Securing-MySQL_1

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

Protecting-and-Securing-MySQL_2

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

Protecting-and-Securing-MySQL_3-(1)

Now the whole setup is done. Hence, MySQL installaion is successfully done!

MySQL-Successful-Installed-(1)

Start Using MySQL

To get started with MySQL, type the following command to go to the root directory.  

sudo mysql -u root

Let’s create a database using the following two commands:

Command 1: create database database_name;

Start-Using-MySQL_1-(1)

Command 2: show databases;

Start-Using-MySQL_2-(1)

Hence, we have successfully created a database using create database command. You are now ready to start using MySQL. MySQL is the best relational database that will keep all your data secure. Many Companies use MySQL because of its solid data security and is supported by multiple applications. So Install MySQL in Linux now and learn SQL in 30 Days – From Basic to Advanced Level!

Also Read



Previous Article
Next Article

Similar Reads

How to Install SQL Workbench For MySQL on Linux?
MySQL Workbench is a visual database design tool that integrates SQL development, administration, database design, creation, and maintenance into a single integrated development environment for the MySQL database system. It was first released in 2014. It is owned by Oracle Corporation. It supports Windows, Linux, and Mac OS operating systems. In th
2 min read
How to Install and configure MySQL on Arch-based Linux Distributions(Manjaro)
MySQL is an open-source relational database management system developed by Oracle based on structured query language (SQL). It is primarily written in C and C++ programming languages and licensed under the GNU Public License. The client-end API is used to query, filter, sort, group, and modify data stored in the database table in the form of rows a
2 min read
How to Install MySQL/MariaDB in Linux?
Installing MySQL or MariaDB in Linux is a straightforward process that provides you with powerful relational database management systems (RDBMS). MySQL and MariaDB are both widely used for web applications, data storage, and other database tasks. They offer similar features, and MariaDB is often seen as a more feature-rich, community-driven alterna
5 min read
MySQL | Common MySQL Queries
MySQL server is a open-source relational database management system which is a major support for web based applications. Databases and related tables are the main component of many websites and applications as the data is stored and exchanged over the web. Even all social networking websites mainly Facebook, Twitter, and Google depends on MySQL dat
9 min read
Functions in MySQL | Numeric, String and Date Time Functions in MySQL
In MySQL, functions play a crucial role in performing various operations on data, such as calculations, string manipulations, and date handling. These built-in functions simplify complex queries and data transformations, making it easier to manage and analyze data within a database. In this article, we will look at these different categories of MyS
4 min read
How to Install SQL Workbench For MySQL on Windows?
MySQL Workbench is a unified visual tool for database architects, developers & Database Administrators. It provides data modeling, SQL development & comprehensive administration tools for server configuration & user administration. It is available for all major operating systems like Windows, Linux & Mac OS. We have to install MySQL
2 min read
How to Install MySQL Workbench on MacOS?
MySQL Workbench is a unified visual tool for database architects, developers & Database Administrators. It provides data modeling, SQL development & comprehensive administration tools for server configuration & user administration. It is available for all major operating systems like Windows, Linux & Mac OS. We have to install MySQL
1 min read
How to Install MySQL on AWS EC2?
AWS or Amazon web services is a cloud service platform that provides on-demand computational services, databases, storage space, and many more services. EC2 or Elastic Compute Cloud is a scalable computing service launched on the AWS cloud platform. In simpler words, EC2 is nothing but a virtual computer on which we can perform all our tasks and we
2 min read
How to Install MySQL on macOS?
MySQL is an open-source relational database managing system. It is used for implementing databases. For any website or any other application, a database is required to store data of websites and applications. Using MySQL server of data can be created. The database created by MySQL is well-organized and consistent. we can extract data from the datab
5 min read
How to Install MySQL on Ubuntu?
Setting up MySQL on Ubuntu is crucial for managing databases efficiently in your development environment. This guide provides a step-by-step walkthrough to help you install MySQL on Ubuntu, ensuring you're ready to store and retrieve data seamlessly. Ubuntu MySQL installationDownloading MySQL in Ubuntu involves several steps, by following these ste
4 min read
How to Install MySQL on Windows?
Installing MySQL on your Windows PC is a straightforward process, but it requires ensuring that your system meets specific hardware and software prerequisites. In this article, We will learn about How to Install MySQL on Windows by understanding each step in detail. What is MySQL?MySQL is an open-source relational database management system (RDBMS)
4 min read
How to Install MySQL WorkBench on Ubuntu?
MySQL Workbench is a powerful and widely-used graphical user interface (GUI) tool developed by Oracle Corporation for managing MySQL databases. It provides a comprehensive set of tools for database administrators, architects, and developers to design, develop, and manage MySQL databases visually. MySQL Workbench allows you to visualize database str
3 min read
How to Install MySQL on Fedora?
MySQL is one of the oldest and most reliable open-source (Available to all) Relational Database Management Systems. Trusted by Millions of users. SQL is used to communicate with Oracle, SQL-Server & MySQL. In MySQL, all data are arranged in the form of a table. MySQL is one of the best RDBMS being used for developing various web-based software
4 min read
Hosting MySQL Server on Linux
To Host a MySQL server on Linux we will follow the below-mentioned steps: Set up a Linux Server to host this MySQL.Get our Users configured in MySQL.Write some Python code and try to connect to that server.The first thing we need is Linux Server and for that, we are using Linode : 1. Open Lincode and click on Create then Lincode. 2. Now fill the de
6 min read
How to Change Default MySQL/MariaDB Port in Linux?
The default port that the MySQL database server runs under Linux is 3306/TCP. Use the commands below to change the default MySQL/MariaDB Database port in Linux. vi /etc/mysql/mariadb.conf.d/50-server.cnf Search for the line MYSQL, find port under this line, and replace port values accordingly. [mysqld] port = 12345 After adding the port save the fi
1 min read
How to Generate Database Dump of MySQL Database in Linux?
We will learn how to Backup and Restore your MySQL Database with Mysqldump query in LINUX. We had always a need that if the production database is corrupted somehow, we should be able to recover it, for recovering we should always keep a backup of the database at particular instances. So, data rollback can be done. First, we will create a Database
2 min read
How to Check the MySQL Version in Linux
Checking the MySQL version on a Linux system is a fundamental task for database administrators and developers. Knowing the MySQL version is important for troubleshooting, compatibility, and applying the appropriate updates. In this article, we'll explore various methods to easily determine the MySQL version running on your Linux server, whether you
3 min read
Checking MySQL Database Size in Linux
MySQL is the most popular open-source database among developers. It was developed and managed by Oracle Corporation and initially released on 23 May 1995. It is compatible with each operating system, Like(Linux, Windows, and macOS) which is major support for web-based applications. In this article, we are going to see how to get the size of a datab
2 min read
How to Install GD module on Linux?
GD is a python library. It provides various features and an async-ready API wrapper for the geometry dash. It is easy to use. It is used to implement the geometry dash API and is also very handy to work with object-oriented design. Installing GD module on Linux Method 1: Using pip to install GD Package Follow the below steps to install the GD packa
2 min read
How to Install Kali Linux on Windows?
Kali Linux is an open-source Linux distribution based on Debian, designed for sophisticated penetration testing and security auditing. Kali Linux includes hundreds of tools for diverse information security activities such as penetration testing, security research, computer forensics, and reverse engineering. This multi-platform solution is accessib
2 min read
How to install and configure Docker on Arch-based Linux Distributions(Manjaro) ?
In this article, we are going to see how to install and configure Docker on Arch-based Linux Distributions. Docker is an open-source containerization platform used for building, running, and managing applications in an isolated environment. A container is isolated from another and bundles its software, libraries, and configuration files. Containers
2 min read
Install Pytorch on Linux
In this article, we are going to see how you can install PyTorch in the Linux system. We are using Ubuntu 20 LTS you can use any other one. To successfully install PyTorch in your Linux system, follow the below procedure: First, check if you are using python’s latest version or not. Because PyGame requires python 3.7 or a higher version, make sure
2 min read
How to Install Deepin on Linux?
Deepin is the top Linux distribution from China, it provides a beautiful, easy-to-use, safe, and reliable operating system for global users. Deepin is based on Debian's stable branch. The feature that sets Deepin aside from the rest of Linux distributions is its desktop environment known as DDE Deepin Desktop Environment, which was described as "th
3 min read
How to Install NuGet from Command Line on Linux?
NuGet is the package manager for the .NET framework. It's very much useful for developers as developers can create, publish and consume packages. The package format of NuGet consists of a single ZIP file with the extension of .nupkg and which is the DLL compiled code like the package’s version number. A NuGet package manager is a cross-platformed m
2 min read
How to Install Git on Windows Subsystem for Linux?
Git is an open-source distributed version control system developed to handle everything from simple to complex projects with performance and speed. Git software allows a team or group of developers to work together, with all using the same files and folders. It gradually reduces the confusion that tends to happen when multiple people are editing th
2 min read
How to Install Linux on Windows PowerShell Subsystem?
There are several ways to Install a Linux subsystem on your Windows PC Powershell Environment. It is good for learners, but it is recommended using original Linux OS if you are a developer as the Subsystem lacks the pre-installed Linux tools. Before we begin installing a Linux subsystem, we need to first enable a Windows feature for Subsystems. Ena
2 min read
How to Install Lazy Script in Kali Linux?
Kali Linux is one of the most advanced hacking OS systems from Linux family. Kali Linux is filled with many hacking tools and supporting learners and hackers worldwide. There are many versions of Kali Linux which provides a good user interface and desired environment. The Lazy Script is designed to help many users to save time and work. The script
2 min read
How to Download and Install Python Latest Version on Linux?
Python is a widely-used general-purpose, high-level programming language. This article will serve as a complete tutorial on How to download and install Python latest version on Linux Operating Systems. On every Linux system including following OS, Ubuntu Linux Mint Debian openSUSE CentOS Fedora and my favourite one, Arch Linux. You will find Python
3 min read
How to Install Z Shell(zsh) on Linux?
The ZSH or Z Shell is a Unix based shell or can be called as a command-line interpreter. It is an extended version of the good old Bourne shell (sh). It does have some features form Bash with lots of added features like automatic cd (Change Directory), spell check, path expansion, and many more. It also supports plugins and themes. Installing ZSH o
2 min read
How to Install Perl on Linux?
Prerequisite: Introduction to Perl Before, we start with the process of Installing Perl on our System. We must have first-hand knowledge of What the Perl Language is and what it actually does?. Perl is a general-purpose, high level interpreted and dynamic programming language. Perl was originally developed for text processing like extracting the re
3 min read