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 provides 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 Ubuntu

First, you will need to update apt package manager index then you will install and configure phpMyAdmin on Ubuntu.

Update apt package manager index by running following command.

sudo apt update

Now install phpMyAdmin by typing following command in 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.

Install phpMyAdmin on Debian - select web server
Install phpMyAdmin on Debian – select web server

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

Install phpMyAdmin on Debian - configuare database for phpmyadmin
Install phpMyAdmin on Debian – configure database for phpmyadmin

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

Install phpMyAdmin on Debian - Enter password for phpMyAdmin
Install phpMyAdmin on Debian – Enter password for phpMyAdmin

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

Install phpMyAdmin on Debian - Login to phpMyAdmin
Install phpMyAdmin on Debian – Login to 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.