How to install PHPMyAdmin on Debian 9 Stretch

Debian Tutorial – Here we will show you how to install PHPMyAdmin on Debian 9 Stretch. PHPMyAdmin is a web based application to manage your MySQL Server. With PHPMyAdmin we can easily perform several administrative tasks to our MySQL or MariaDB Server such as create, edit, delete databases, users and also perform queries, export and import databases and many more. PHPMyAdmin can be easily installed on top of Debian 9 Stretch with LAMP Server installed on it. Please follow the following guide to install PHPMyAdmin on Debian.

Steps to install PHPMyAdmin on Debian 9 Stretch

  1. Install LAMP Server
  2. Install PHPMyAdmin
  3. Configure PHPMyAdmin

Step 1. Install LAMP Server on Debian 9

PHPMyAdmin needs a working web server. Please refers to our previous tutorial to install LAMP Server on Debian 9 Stretch.

Step 2. Install PHPMyAdmin

Use the following command to install PHPMyAdmin on Debian

apt install phpmyadmin

Output

root@debian-vm:/home/dhani# apt install phpmyadmin
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  dbconfig-common dbconfig-mysql javascript-common libjs-jquery libjs-sphinxdoc libjs-underscore
  php-bz2 php-pear php-php-gettext php-phpseclib php-tcpdf php7.0-bz2
Suggested packages:
  php-libsodium php-gmp php5-imagick www-browser
Recommended packages:
  php5-gd php5-mcrypt
The following NEW packages will be installed:
  dbconfig-common dbconfig-mysql javascript-common libjs-jquery libjs-sphinxdoc libjs-underscore
  php-bz2 php-pear php-php-gettext php-phpseclib php-tcpdf php7.0-bz2 phpmyadmin
0 upgraded, 13 newly installed, 0 to remove and 0 not upgraded.
Need to get 13.2 MB of archives.
After this operation, 51.0 MB of additional disk space will be used.
Do you want to continue? [Y/n]

During install process, you will need to configure the web server you are running. In my case, I use Apache.

And then select Yes to perform dbconfig-common to configure phpmyadmin with MySQL or MariaDB.

After the installation completed, you can try to open the PHPMySQL using web browser and type the IP address with the following format

http://ip_address/phpmyadmin

And you should see something like this

Fix Login Error on PHPMyAdmin

Please skip this step if you have successfully login and use phpmyadmin on Debian 9 server. In some cases, we cannot login to phpmyadmin. Access denied for user ‘root’@’localhost’.

To fix this, make sure MariaDB Service is running. If stopped, start it.

root@debian-vm:/etc/phpmyadmin# systemctl status mariadb
● mariadb.service - MariaDB database server
   Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2017-08-09 12:31:44 WITA; 8min ago
 Main PID: 30049 (mysqld)
   Status: "Taking your SQL requests now..."
    Tasks: 28 (limit: 4915)
   CGroup: /system.slice/mariadb.service
           └─30049 /usr/sbin/mysqld

Aug 09 12:31:43 debian-vm systemd[1]: Starting MariaDB database server...
Aug 09 12:31:43 debian-vm mysqld[30049]: 2017-08-09 12:31:43 139641452937792 [Note] /usr/sbin/mysqld (mysqld 10.1.23-MariaDB-9
Aug 09 12:31:44 debian-vm systemd[1]: Started MariaDB database server.

Now we need to reconfigure PHPMyAdmin with this command below.

dpkg-reconfigure -plow phpmyadmin

The phpmyadmin configuration wizard will open up. On the first screen, select Yes

Now select TCP/IP

Select localhost as the hostname

Specify the MySQL port.

Provide MySQL Database name for phpmyadmin

MySQL username for phpmyadmin. Make sure you only type ‘root’, not root@localhost.

Now specify root password

Specify the name of the database’s administrative user. This usually root.

Now refresh or re open phpmyadmin via browser and all should now works. Thank you for reading this how to install phpmyadmin on Debian 9 Stretch tutorial. See you next time.

2 Comments

  1. Alter step “Specify the name of the database’s administrative user. This usually root.” next step is window:

    An error occurred while installing the database: mysql said: ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: NO) . Your options are:
    * abort – Causes the operation to fail; you will need to downgrade, reinstall, reconfigure this package, or otherwise manually intervene to continue using it. This will usually also impact your ability to install other packages until the installation failure is resolved. * retry – Prompts once more with all the configuration questions (including ones you may have missed due to the debconf priority setting) and makes another attempt at performing the operation. │
    * retry (skip questions) – Immediately attempts the operation again, skipping all questions. This is normally useful only if you have solved the underlying problem since the time the error occurred. │
    * ignore – Continues the operation ignoring dbconfig-common errors. This will usually leave this package without a functional database.

    Next step for database installation: │ abort │ retry │ retry (skip questions) │ ignore │

Leave a Reply

Your email address will not be published.


*