How to Install PhpMyAdmin on a Ubuntu 22.04 VPS or Dedicated Server
phpMyAdmin is one of the most popular open-source database administration software written in PHP. The portable web application can manage both MySQL and MariaDB.
Executing commands and managing MySQL database from the command line is not very intuitive especially if you are performing a lot of database tasks. This is where phpMyAdmin comes in to help you manage tables, columns, indexes, users, permissions and more using a graphical user interface.
MySQL is quickly replacing commercial database management system and is considered as one of the best database software for a production environment. MySQL and phpMyAdmin are the de facto standards for managing most modern web applications databases.
In this guide, we will show you how you can install phpMyAdmin on your Ubuntu 22.04 server
- An Ubuntu 22.04 VPS plan
- A non-root user with sudo privileges
- MySQL database community server. You can run the command below to install MySQL on your Ubuntu 22.04 server if you haven’t done so.
$ sudo apt-get update $ sudo apt-get install mysql-server
Step 1: Install phpMyAdmin
Ubuntu maintains a central repository for most packages and we can install phpMyAdmin using the command below:
$ sudo apt-get install phpmyadmin
Once you are prompted to confirm the installation, press Y and then Enter.
Step 2: Configure the phpMyAdmin installation
You will be taken through a series of steps to configure your phpMyAdmin installation. The first step prompts you to choose a server from apache2 and Lighttpd. Choose apache2, then click TAB and Enter to proceed as shown below:
On the next screen, you will be prompted to configure a database that phpMyAdmin will use for administration purposes. Select ‘Yes’ and press Enter to proceed.
Next, create an application password for phpMyAdmin. Kindly type a strong password with a mix of lower case letters, upper case, numbers and symbols for security purposes. Then press TAB and and Enter to proceed as shown below:
You will be prompted to confirm the password one more time as shown below.
Press TAB then press Enter to proceed.
If you miss any of the steps below, you can reconfigure phpMyAdmin by running the command below:
$ sudo dpkg-reconfigure phpmyadmin
Also if you want to completely remove phpMyAdmin and start all over, run the command below:
$ sudo apt-get purge phpmyadmin
Step 3: Create a symbolic link
In order to access phpMyAdmin via a browser, you need to create a symbolic link on the path ‘/etc/apache2/conf-enabled/’. You will get a 404 error if you skip this step.
You will need to run the three commands below to create the link on your Ubuntu 22.04 server:
$ sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf available/phpmyadmin.conf $ sudo a2enconf phpmyadmin.conf $ sudo service apache2 reload
Step 4: Test the installation
If you followed the above steps, your phpMyAdmin installation should be successful. You can visit the url http://220.127.116.11/phpmyadmin on your server to test the installation. Remember to change the IP address with your public IP address associated with your Ubuntu 22.04 server or domain name. You should see a screen similar to the one below:
Enter your username and password to proceed. If the details are correct, you will get the below phpMyAdmin User Interface and you can now manage your database by creating tables, adding fields, indexes, inserting, updating and deleting record.
You have now configured phpMyAdmin on your Ubuntu 22.04 server and managing your databases will be a breeze. For security reasons, never configure your websites to run using the root user of your MySQL database.
In addition, you should consider installing an SSL certificate to protect your phpMyAdmin login details from landing into the wrong hands especially if you are logged into your server on a public network. We believe this guide will help you to manage your MySQL database better.