In this article I will share how to Install phpMyAdmin Ubuntu Linux Easy using the terminal. The phpMyAdmin requires a Web Server, MySQL, and PHP.
Previously we have learned Install Laravel First Time In Ubuntu Linux. To be able to create CRUD, we need phpMyAdmin. However, before starting the phpMyAdmin installation, I recommend updating the system so that we can install the latest version. Please using the command:
sudo apt update
1. Install apache2
Apache2 is a one of a kind web server software. With a web server, it allows us (users) to communicate with the server via a browser. In this article because we want to install locally, then the server will be on the local too. Use the following command to install the apache2 web server:
sudo apt install apache2
After the installation is complete, we must check whether the installation is properly installed or not. Copy the address http://localhost, then paste it into the browser and ENTER. If an image like below is appears, the installation was successful.
2. Install MySQL
To be able to input, search, update and delete data in the database, a programming language is needed, one of them is SQL (Structured Query Language).
To be able to run SQL on the server, we need a system. One of them is called Relational Database Management System (RDBMS). One of the RDBMS is MySQL. To be able to install MySQL on Ubuntu, use the following command:
sudo apt install mysql-server
To check whether mysql-server has been installed correctly or not, use the following command:
If you get results like the following, it means that mysql has been successfully installed properly:
neon@linux:~$ sudo mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 26 Server version: 8.0.30-0ubuntu0.22.04.1 (Ubuntu) Copyright (c) 2000, 2022, 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>
To exit the mysql command use the following command:
mysql> exit ## or ## mysql> quit
3. Install PHP
sudo apt-get install php php-mysql libapache2-mod-php php-cli php-cgi php-gd mysql-server mysql-client zip -y
After the installation is complete, let’s check whether php has been installed properly or not. Now create a file with the name info.php use the following command:
sudo gedit /var/www/html/info.php
*I use gedit for text editor. You can use your favorite text editor.
Copy the following code and paste to info.php:
<?php phpinfo(); ?>
So it will look like this, After that SAVE.
Open a browser and use the address http://localhost/info.php. If it looks like the following image, then the php installation is successful:
4. Install phpMyAdmin
phpMyAdmin is free software written in PHP, intended to handle MySQL administration over the Web. To install phpMyAdmin, use the following command:
sudo add-apt-repository ppa:phpmyadmin/ppa sudo apt update sudo apt install phpmyadmin
After that, a web server selection image will appear. There are two list:
Use SPACE to select apache2 until “*” appears on the list. Then press TAB, it will move to “Ok” and press ENTER:
Then a pop up will appear again for the configuration as shown in the following image, select “Yes” and press ENTER:
After that, there will be a request for a password. I did not create a password for right now, then I only press TAB and ENTER. If you want to use a password, please fill it as desired.
To see if phpmyadmin is installed properly or not, copy http://localhost/phpmyadmin and paste to browser, then ENTER. If the image below appears, then phpMyAdmin has been successfully installed.
Now, fill username with “root” and a blank password then click GO.
If you get an error mysqli::real_connect(): (HY000/1045): Access denied for user ‘root’@’localhost’ (using password: YES) when loggin like the image below:
It happened because we logged in without a password. By default, the phpmyadmin configuration does not allow login without a password. Therefore we will change the settings a bit. Use the following command in the terminal:
sudo gedit /etc/phpmyadmin/config.inc.php
Delete “//” before $cfg[‘Servers’][$i][‘AllowNoPassword’] = TRUE; then SAVE the file.
I hope this short tutorial Install phpMyAdmin Ubuntu can be useful for you.