How To Install phpMyAdmin On Ubuntu

phpMyAdmin is a free, open-source tool used to manage MySQL and MariaDB databases through a web-based interface. Written in PHP, it allows users to perform a wide range of database operations, including creating, modifying, and deleting databases, tables, and records.

Please follow the post How To Install phpMyAdmin On Ubuntu to install it successfully.

1. Update Package List

Before installing, update your system packages to ensure you get the latest versions:

sudo apt update && sudo apt upgrade -y

2. Install Apache

You can refer to the post How To Install Apache On Ubuntu 20.04 to install Apache 2.

3. Install MySQL

Install MySQL using apt command:

sudo apt install mysql-server

When prompted, typing Y to confirm installation and then press ENTER.

When the installation is complete, run the following command to secure your MySQL. This command will remove some insecure default settings and block access to your database system.

sudo mysql_secure_installation

When prompted, press Y to setup validate password.

Next, select a level of password validation. Enter your root password. The server will show the password strength for the root password you just entered and the server will ask if you want to continue with that password. If you accept, press Y.

For the rest of the questions, press Y and press ENTER key at each prompt.

When finished, Test login to MySQL with root user by the command:

sudo mysql

You should see output like this:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 807
Server version: 8.0.23-0ubuntu0.20.04.1 (Ubuntu)
 
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
 
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
mysql> 
MySQL Result

Then, exit MySQL console by command:

exit

Configure Password Access for the MySQL Root Account

Login with root user.

sudo mysql
SELECT user,authentication_string,plugin,host FROM mysql.user;
Note: Replace ‘your_secure_password‘ with your password.
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_secure_password';

Verify mysql.user table with the command:

SELECT user,authentication_string,plugin,host FROM mysql.user;
exit

4. Install PHP

First, install all the necessary dependencies:

sudo apt install curl gpg gnupg2 software-properties-common ca-certificates apt-transport-https lsb-release

Add PHP repository to your system:

sudo add-apt-repository ppa:ondrej/php

Update your APT repositories.

sudo apt update

Install PHP 8.3 with command:

sudo apt install php8.3

And packages:

sudo apt install php8.3-{exif,bz2,intl,soap,cli,pdo,mysql,zip,gd,mbstring,curl,xml,bcmath,common,xmlrpc,gmp}

Next, verify your PHP version:

php -v

You should see output like this:

PHP 8.3.16 (cli) (built: Jan 19 2025 13:45:36) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.16, Copyright (c) Zend Technologies
    with Zend OPcache v8.3.16, Copyright (c), by Zend Technologies

5. Install phpMyAdmin

Run the following command to install phpMyAdmin:

sudo apt install phpmyadmin -y

During installation, you will be prompted to choose a web server. Select Apache.

Then, choose Yes when asked if you want to configure the database for phpMyAdmin with dbconfig-common. Set a strong password for phpMyAdmin when prompted.

Select the abort option

Open your web browser and go to:

http://your-server-ip/phpmyadmin

Then, see your result:

Install phpMyAdmin result

This is the end of the How To Install phpMyAdmin On Ubuntu.

Follow us for the more helpful posts!

We hope this is a useful post for you.

Thank you for reading!

 

 

 

4.8 5 votes
Article Rating

Aaron LX

Aaron is a passionate writer, crazy about shopping, eCommerce and trends. Besides his outstanding research skills and a positive mind, Aaron eagerly shares his experience with the readers.

Leave a Reply or put your Question here

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x