MySQL Server is an RDBMS (Relational Database Management System) renowned for its open-source nature. It serves as a robust platform for the storage, organization, and retrieval of structured data. This software is extensively utilized in various domains to efficiently manage relational databases. MySQL Server empowers developers and administrators to build and manage databases efficiently, making it a vital component in various applications and system administration tasks.
MySQL Server in Linux Mint is useful for data management, web development, and system administration. It provides a reliable database solution, seamless integration with web technologies, and efficient data storage and retrieval capabilities, empowering developers and administrators to build robust applications and effectively manage databases.
The purpose of this post is to teach you how MySQL can be installed on Linux Mint 21 and how its service can be managed.
How to Install MySQL Server on Linux Mint?
MySQL server is available on the default/official repository which can be installed by following only two steps, which are explained below:
Step 1: Update the Packages List
Open a terminal by pressing Ctrl+Alt+T and update the package lists by running the following command:
sudo apt update
Step 2: Install the MySQL
Once the update is completed, install the MySQL Server package by executing the following command:
sudo apt install mysql-server
How to Manage the MySQL Service on Linux Mint?
MySQL server is managed by a service named mysql in Linux Mint. If you have installed the MySQL server on Mint, then you must be aware of the commands to start/stop/restart/enable/disable MySQL. Let’s see how they work:
Once the installation is completed, you can start the MySQL service by running the following command:
sudo systemctl start mysql
Initially, the MySQL service is not set to start by default on the reboot. For this, you have to enable the service via the command:
sudo systemctl enable mysql
It is necessary to check the status of the service to ensure the service is running actively and is enabled on every reboot as well:
sudo systemctl status mysql
There are other systemctl commands as well that can be used to manage the MySQL service. The commands with their intended usage are listed below:
sudo systemctl disable mysql #To disable the MySQL service
sudo systemctl stop mysql #To stop the MySQL service
sudo systemctl restart mysql #To restart the MySQL service
How to Uninstall MySQL Server From Linux Mint?
If you do not need MySQL server’s support on your Linux Mint system, you can easily remove the package from the system using the command as provided below:
sudo apt autoremove mysql-server
MySQL, as discussed, is one of the most used RDBMS for Linux and other operating systems. It can be installed on Linux Mint using a simple command “sudo apt install mysql-server” in the terminal. As MySQL is based on a service and thus it is necessary to understand how to manage the MySQL service as well. We have also listed the necessary commands to start, restart, enable, and stop the MySQL services on Linux Mint.
Overall, you have learned how to install MySQL server, manage the SQL service, and the method to uninstall MySQL from Linux Mint as well. Keep visiting Linux Genie for more updated tips and tricks for Linux Mint.