• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

BeginnersBox

How to Guides, Tutorials and Much More

  • Home
  • Tutorials
  • Opinions
You are here: Home / Tutorials / How to Install MySQL on Ubuntu 24.04?

How to Install MySQL on Ubuntu 24.04?

November 23, 2025 by Sourabh Verma | Updated on: November 28, 2025

Share on Facebook Share on Twitter Share on LinkedIn Share on Reddit Share on WhatsApp Share via Email

MySQL is a well known relational database system developed by Oracle. It is used to store, manage and retrieve the data. When it comes to performance, MySQL is fast, reliable and easy to manage. MySQL today is used by most of the mobile applications, websites, and Enterprise level softwares. MySQL can be used with various setups as it supports various storage engines which makes it most suitable for scalable setups. Another best thing about MySQL is that it is ACID complaint which ensures that the database transactions are highly reliable.

Let’s see how to install MySQL on Ubuntu 24.

In this Tutorial, you will learn

  • Prerequisites
  • Step 1 – Update the system
  • Step 2 – Install MySQL on Ubuntu 24.04
  • Step 3 – Create Database
  • Conclusion

Prerequisites

  • An Ubuntu 24 server
  • A sudo user with administrative privileges

Step 1 – Update the system

Let’s first update the system by executing a couple of commands.

# sudo apt update
# sudo apt upgrade -y

Step 2 – Install MySQL on Ubuntu 24.04

Now let’s install MySQL on Ubuntu using the command given below

# sudo apt install mysql-server -y

Set up MySQL and use the options as shown below

# sudo mysql_secure_installation
Enter current password for root (leave blank if none): {Just hit Enter key here}
Switch to unix_socket authentication? (Y/n):N {Press N and hit Enter}
Change the root password? (Y/n):Y {Press Y and hit Enter to setup root password}
Remove anonymous users? (Y/n):Y {Press Y and hit Enter}
Disallow root login remotely? (Y/n):Y {Press Y and hit Enter}
Remove test database and access to it? (Y/n): Y {Press Y and hit Enter}
Reload privilege tables now? (Y/n): Y {Press Y and hit Enter}

Execute the given below command to check the installation

# sudo mysql --version

Output

mysql Ver 8.4.5 for Linux on x86_64 (MySQL Community Server - GPL)

Now lets start and enable the MySQL server

# sudo systemctl start mysql
# sudo systemctl enable mysql

Step 3 – Create Database

Final step is to create a database and set it up

# sudo mysql -u root -p

Enter password that you have created in step 2

Create a database

mysql> CREATE DATABASE your_database_name;

Create a user

mysql> CREATE USER 'user_name'@localhost IDENTIFIED BY 'strong_password';

Grant privileges to user for the database

GRANT ALL PRIVILEGES ON your_database_name.* TO 'user_name'@'localhost';

Lets refresh the privileges and exit MySQL

FLUSH PRIVILEGES;
EXIT;

Conclusion

With this we have successfully installed MySQL on Ubuntu 24.

Category: Tutorials Tagged In: linux, Server, Ubuntu

Share on Facebook Share on Twitter Share on LinkedIn Share on Reddit Share on WhatsApp Share via Email

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

About Sourabh

Hi, I am Sourabh. With over 12 years of experience in Linux, Windows, servers, databases and other I.T related areas, I make sure to publish easy and well tested tutorials and opinions. I hope you like my work. Thanks

Stay with BeginnersBox

Follow on FacebookFollow on TwitterFollow on LinkedInSubscribe on YouTubeFollow on Instagram Subscribe to RSS Feed

Copyright © 2025 · BeginnersBox · All Rights Reserved.

  • Contact Us
  • Privacy Policy
  • Disclaimer