How to Install MySQL and phpMyAdmin on Ubuntu 24.04

Last update: 05-22-2024

In this guide, we will walk you through the steps to install MySQL and phpMyAdmin on Ubuntu 24.04. MySQL is a powerful and widely-used database management system, while phpMyAdmin provides an intuitive web interface for managing MySQL databases. These tools are essential for developers and administrators looking to efficiently manage their data.

Step 1: Update Your System

First, update your package list to ensure you have the latest information about available packages:

sudo apt update

Step 2: Preconfigure phpMyAdmin

Next, we'll preconfigure phpMyAdmin to use Apache as the web server:

echo "phpmyadmin phpmyadmin/dbconfig-install boolean false" | sudo debconf-set-selections
echo "phpmyadmin phpmyadmin/reconfigure-webserver multiselect apache2" | sudo debconf-set-selections

Step 3: Install MySQL and phpMyAdmin

Now, install MySQL server, PHP, and phpMyAdmin:

sudo apt install php mysql-server phpmyadmin

Step 4: Secure Your MySQL Installation

Run the following command to secure your MySQL installation. This step is crucial for ensuring your database is protected:

sudo mysql_secure_installation

Step 5: Configure MySQL User Authentication

Log in to the MySQL shell as the root user:

sudo mysql

Then, alter the root user to use the mysql_native_password authentication method and set a new password:

alter user 'root'@'localhost' identified with mysql_native_password by 'P@55word';

Exit the MySQL shell:



You have now successfully installed MySQL and phpMyAdmin on your Ubuntu 24.04 server. MySQL offers robust performance and scalability, making it a preferred choice for many applications, while phpMyAdmin's user-friendly interface makes database management a breeze. Access phpMyAdmin by navigating to http://your_server_ip/phpmyadmin in your web browser. Use the MySQL root credentials to log in and start managing your databases efficiently.


Add a new comment: