Home → Articles → How to Install MySQL Database Server on Ubuntu 26.04

How to Install MySQL Database Server on Ubuntu 26.04

26 Apr, 2026

Introduction

MySQL is a free, open-source relational database management system that stores and organizes data in structured tables with rows and columns. Many web applications, content management systems like WordPress, and e-commerce platforms use MySQL as their backend database. The database server supports ACID (Atomicity, Consistency, Isolation, Durability) compliance, transactions, and replication, making it suitable for both small projects and large-scale enterprise applications.

This guide teaches you how to install MySQL on Ubuntu 26.04.

Prerequisites

Before you start:

Install MySQL Server

The MySQL package is available by default on the Ubuntu repositories. To install the package, follow these steps.

Run MySQL Secure Installation

MySQL includes a security script that helps you set a root password and remove insecure default settings. Run this script after the initial install to secure your database server.

Manage MySQL Service

MySQL runs as a system service on Ubuntu under the name mysql. You can manage this service using specific commands to start, stop, restart, and check the MySQL status. These commands ensure your MySQL server runs smoothly and make maintenance easier on your system.

Check MySQL Service Status

console
$ sudo systemctl status mysql

Output:

● mysql.service - MySQL Community Server
     Loaded: loaded (/usr/lib/systemd/system/mysql.service; enabled; preset: enabled)
     Active: active (running) since Sun 2026-04-26 10:20:30 UTC; 7min ago
 Invocation: 9ee1b20041d9460fbc36b9adaa96cf84
    Process: 34469 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
   Main PID: 34479 (mysqld)
     Status: "Server is operational"
      Tasks: 36 (limit: 417)
     Memory: 259.4M (peak: 481.6M, swap: 273.5M, swap peak: 273.5M)
        CPU: 5.355s
     CGroup: /system.slice/mysql.service
             └─34479 /usr/sbin/mysqld

Press Ctrl + C to return to the console.

Enable MySQL to Start on Boot

console
$ sudo systemctl enable mysql

Output:

Synchronizing state of mysql.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable mysql

Start MySQL Service

console
$ sudo systemctl start mysql

Stop MySQL Service

console
$ sudo systemctl stop mysql

Restart MySQL Service

console
$ sudo systemctl restart mysql

Test the MySQL Database Server

In this section, you'll test the MySQL server by creating a sample database and table, inserting some data, and querying the table to ensure everything functions correctly.

Your MySQL database server is working as expected.

Conclusion

In this guide, you have installed MySQL on Ubuntu 26.04 using apt, secured the database server with the mysql_secure_installation script, and created a sample database with tables and records. Now that you have MySQL running, consider integrating the database with a web application using PHP with PDO or connect it with Python using the mysql-connector-python library to build data-driven applications.