How to install phpMyAdmin on Debian 9

Table of Contents
Install phpMyAdmin on Debian
phpMyAdmin is a database management tool for MySQL which comes with web interface. By using phpMyAdmin users can interact with MySQL easily. I also provide the most useful functions to interact with the MySQL databases. This tutorial outlines how to install phpMyAdmin on Debian 9.
Prerequisites
1. Before you start installing phpMyAdmin on Debian 9. You must have the non-root user account on your server/desktop with sudo privileges.
2. Make it sure that LAMP stack is installed on the server. If you have not installed it please use the following link to install How to install LAMP stack on Debian 9.
Install phpMyAdmin on Debian
First, you will need to update apt package manager index then you will install and configure phpMyAdmin on Debian.
Update apt package manager index by running following command.
sudo apt update
Now install phpMyAdmin by typing following command in the terminal, it will also install required dependencies for phpMyAdmin.
sudo apt install phpmyadmin php-mbstring php-gettext
You will be asked for basic configuration for phpMyAdmin. First, you will need to select apache as web server. Select Apache and click OK.

Now it will ask you to configure the database for phpMyAdmin. Select YES and press Enter to continue.

Now you will be prompted for setting the password. Enter the password and click OK to continue.

Now enter the following command to enable php-mbstring extension
sudo phpenmod php-mbstring
Restart apache2 by typing following command
sudo systemctl restart apache2
Configure phpMyAdmin
Apache configuration file will be created at /etc/phpmyadmin/apache.conf. You can edit configuration file.
Now check if soft link is created at /etc/apache2/conf-enabled/phpmyadmin.conf. If not created by default then please create by typing following.
sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf-enabled/phpmyadmin.conf
Now enter following
sudo a2enconf phpmyadmin
After executing above entries please type following in terminal to restart Apache service
sudo systemctl restart apache2
Now you can login to phpMyAdmin by going to following link https://YOUR_DOMAIN_NAME/phpmyadmin or on your desktop http://127.0.0.1/phpmyadmin/
URL not found error (Optional)
If you dont get any error then please drop this step and If you get http://127.0.0.1/phpmyadmin/ this URL not found error then do following things
Enter following command to edit Apache configuration file.
sudo -H gedit /etc/apache2/apache2.conf
Now add the following line to the end of the file.
Include /etc/phpmyadmin/apache.conf
Then restart apache server by typing.
sudo systemctl restart apache2
Now you can login to phpMyAdmin by going to following link https://YOUR_DOMAIN_NAME/phpmyadmin or on your desktop http://127.0.0.1/phpmyadmin/
Create Database User
Open MySQL shell by typing following command
sudo mysql
Create a new user by typing following command
CREATE USER 'user_name'@'localhost' IDENTIFIED BY 'password';
Grant all permissions to the created user by typing
GRANT ALL PRIVILEGES ON *.* TO 'user_name'@'localhost' WITH GRANT OPTION;
Exit MySQL shell by typing
exit;
Now you can login with created users credentials and access phpMyAdmin

Conclusion
In this tutorial you have learned how to install phpMyAdmin on Debian 9. If You have any queries regarding this please comment below.
LATEST POSTS
-
How to Install Opera Browser on Linux Mint 19
-
How to Add Swap Space on Debian 10
-
How to Create Sudo User on Ubuntu
-
How to Install PyCharm on Linux Mint 19
-
How Install Redis on CentOS 8
-
How to Install Opera Browser on Debian 9
-
How to install PHP 7.2 on Ubuntu 18.04
-
How to Install Google Chrome on Debian 10
-
How to migrate MySQL database between two servers
-
How to Install Go on CentOS 7
-
How to Install IntelliJ IDEA IDE on Fedora 29
-
How to Install Ruby on Ubuntu 18.04