A database is an essential component of any web application. Developers use it to store and retrieve data in response to user queries.
That’s why a database management system (more commonly known as DBMS) is critical to the operations of any web application. As a result, you’ll find a DBMS in every development stack. You also get several popular DBMS options, including phpMyAdmin.
This article covers the process of installing phpMyAdmin on Ubuntu.
However, let’s start with an introduction to this popular DBMS.
Table Of Content
- Introducing phpMyAdmin
- The Benefits of Using phpMyAdmin
- The Process of Installing phpMyAdmin on Ubuntu
- Conclusion
- FAQ
Introducing phpMyAdmin
phpMyAdmin is a free and open-source web-based database management tool for MySQL and MariaDB.
It is widely used by developers and website administrators to simplify database management tasks. The core package is written in PHP and is accessible via any web browser.
Its USP is the intuitive graphical user interface (GUI) that allows users to create, modify, and delete databases, tables, and records. It also allows you to import and export data, run SQL queries, and manage user permissions.
Because of its open-source origins, phpMyAdmin, available in all major languages so that you can use it in your preferred language.
The Benefits of Using phpMyAdmin
As we write this, phpMyAdmin is very popular because of several benefits, such as:
1. phpMyAdmin offers a web-based user interface for managing MySQL and MariaDB databases without the need for complex command-line tools.
2. Users can easily create, modify, and delete databases and tables using phpMyAdmin. In addition, they can manage database users and permissions, as well as import and export data.
3. phpMyAdmin allows users to write and execute SQL queries directly from the web interface, making complex database operations simple.
4. phpMyAdmin maintains detailed logs of changes to the database, tables, and views.
5. phpMyAdmin is open-source software, which means that it can be freely modified and customized to meet specific needs.
6. phpMyAdmin can be run on any platform that supports PHP and a web server, such as Windows, Linux, and macOS.
The Process of Installing phpMyAdmin on Ubuntu
Now that you have a clear idea of why phpMyAdmin is a good fit for your projects, let’s go into the details of how you can install phpMyAdmin on Ubuntu.
Let’s start with prerequisites.
Prerequisites of the Installation Process
The following are the prerequisites of the process:
- A server that supports a LAMP or LEMP stack. Here, Ubuntu is the Linux component. We’ll install the rest of the components of the stack in the following process.
- An administrator account or a user with sudo privileges.
Install LAMP Stack on Ubuntu 20.04
As you saw above, installing a LAMP stack is a critical prerequisite of the process. So before we install phpMyAdmin on Ubuntu, let’s set up the LAMP stack. Out of the four components, Ubuntu is already installed on the server, so that takes care of the Linux part.
Let’s install the rest of the three components.
Step # 1: Update System Packages
Before actually starting the installation process, it’s always a great idea to update the system packages so that you get the latest stable version of the installed packages.
For this, use the following command:
# sudo apt update
Step # 2: Install Apache
If Apache isn’t installed on your Ubuntu system, now would be a good time to install it on the system. For this, use the following command:
# sudo apt install apache2
Step # 3: Allow Apache Through the System Firewall
After installing Apache, it is strongly recommended that you enable Apache services through the firewall. Use the following command:
# sudo ufw allow in “Apache”
Now check the status of the Apache services with the command:
# sudo ufw status
As you can see, Apache services are allowed through the firewall. You can also double-check whether Apache is working on Ubuntu by going to the IP address of your server in the browser:
If Apache is working properly on the localhost, you will see something similar to the following web page:
Step # 4: Install MySQL Server
Next, use the following command to install the MySQL server on Ubuntu 20.04:
# sudo apt install mysql-server -y
Step # 5: Install PHP
Run the following command on the Ubuntu terminal to install PHP and the necessary dependent libraries and packages:
# sudo apt install php libapache2-mod-php php-mysql
Once the process finishes, you need to verify the success of the process by getting the installed PHP version. For this, use the “-v” option with the “php” command in the terminal:
$ php -v
As you can see from the output, the process has installed PHP 7.4.3 on Ubuntu 20.04.
Now let’s install phpMyAdmin on Ubuntu.
Install phpMyAdmin on Ubuntu
Now that the prerequisites are in place, we can go ahead and install phpMyAdmin on the Ubuntu 20.04 server running the LAMP stack.
Step # 1: Install phpMyAdmin
Launch the terminal and install phpMyAdmin on Ubuntu 20.04 by running the following command with “sudo” privileges:
$ sudo apt install phpmyadmin
Once the dependencies have been downloaded, you’ll see the Package Configuration wizard.
Start by choosing “apache2” and press the Enter key:
Following that, you will be prompted to create a password for database access. Enter the password and hit Enter:
Retype the password and press Enter once more:
You can see that the installation process finishes in the terminal:
Step # 2: Access phpMyAdmin in Ubuntu Terminal
After the installation finishes, connect to the phpMyAdmin database via the terminal.
$ sudo mysql
Next, use the following command to see all databases that are linked to the MySQL database:
mysql> show databases;
Now you need to grant the phpMyAdmin database all local host privileges:
GRANT ALL PRIVILEGES ON *.* To ‘phpmyadmin ‘@’ localhost’;
To exit the command line, flush all privileges before using the “Exit” command:
> FLUSH PRIVILEGES; > Exit;
Step # 3: Access phpMyAdmin in the Browser
Now, browse to the “http://ip-address>/phpmyadmin” in the browser to access the phpMyAdmin database.
The following output indicates that we successfully installed phpMyAdmin without any errors.
Conclusion
Installing phpMyAdmin on Ubuntu is a straightforward process that can greatly simplify database management for developers and website administrators.
By following the steps outlined in this guide, you can easily install and configure phpMyAdmin on your Ubuntu system. Additionally, it’s important to ensure that you keep your phpMyAdmin installation up-to-date with the latest security patches to prevent potential security vulnerabilities.
With the power of phpMyAdmin at your fingertips, you can easily manage your databases, execute SQL queries, and perform various administrative tasks with ease.
FAQ
1- Is phpMyAdmin and MySQL the same?
→ No, phpMyAdmin and MySQL are not the same. MySQL is a database management system, while phpMyAdmin is an open-source software tool used to manage MySQL databases. It provides an interface for users to interact with the underlying MySQL server using web browsers. The phpMyAdmin software can be used to create and edit databases, tables, fields, and records, as well as run SQL queries.
2- What is the difference between PHP and phpMyAdmin?
→ PHP is a scripting language for programming web applications. It is used to create dynamic web pages and can be embedded into HTML code. PHP can be used to manipulate data in a database, such as MySQL or PostgreSQL. It can also be used to create custom functions and classes that help expedite development tasks.
phpMyAdmin is a free, open-source tool for managing MySQL and other databases through a web interface. It provides an easy-to-use graphical interface for administering databases and allows users to perform tasks such as creating, editing, and deleting databases, tables, fields, and records.
3- How do I run phpMyAdmin in Linux?
→ Running phpMyAdmin in Linux is a relatively straightforward process. It can be done from the command line or with an automated installation script.
First, install the Apache web server and the required PHP extensions for phpMyAdmin to work correctly.