PHPMyAdmin is a free software tool written in PHP, intended to handle the administration of MySQL over the Web interface. phpMyAdmin supports a wide range of operations on MySQL and MariaDB. In this article we look at how you install PHPMyAdmin on Kali Linux & Debian Linux system.

Most frequent database operations – (managing databases, tables, columns, relations, indexes, users, permissions, etc) can be performed via the web console, while you still have the ability to directly execute any SQL statement.


Core Features of phpMyAdmin

  • An intuitive cool web interface
  • Support for most MySQL features
  • Import data from CSV and SQL
  • Export data to various formats: CSV, SQL, XML, PDF, ISO/IEC 26300 – OpenDocument Text and Spreadsheet, Word, LATEX, and others
  • Administering multiple servers
  • Creating PDF graphics of your database layout
  • Creating complex queries using Query-by-example (QBE)
  • Searching globally in a database or a subset of it
  • Transforming stored data into any format using a set of predefined functions, like displaying BLOB-data as image or download-link

The following is the procedure to follow while installing PHPMyAdmin on Kali Linux or any other Debian based system.

Step 1: Update System

Start by ensuring the system is updated.

sudo apt update
sudo apt upgrade

Because of kernel updates a reboot may be required.

sudo reboot

Step 2: Install PHP and Apache

The next step is the installation of PHP, required modules and Apache Web Server.

sudo apt -y update
sudo apt -y install wget php php-cgi php-mysqli php-pear php-mbstring libapache2-mod-php php-common php-phpseclib php-mysql

Confirm installation of PHP by checking the version:

$ php --version
PHP 7.4.11 (cli) (built: Oct  6 2020 10:34:39) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.11, Copyright (c), by Zend Technologies

Step 3: Install MariaDB / MySQL database Server

Since you’re using phpMyAdmin to administer MySQL or MariaDB database server you should have database server already installed. You can also reference our guides below.

How To Install MariaDB on Kali Linux

How To Install MySQL 8.0 on Kali Linux

Once the database server is installed and running you can then proceed to install phpMyAdmin on Kali Linux and Debian system.

Step 4: Install PHPMyAdmin on Kali Linux | Debian

From the phpMyAdmin downloads page you should be able to check the latest release.

Use wget command line tool to download the latest version of phpMyAdmin:


Extract downloaded archive file using tar:

tar xvf phpMyAdmin-5.0.4-all-languages.tar.gz

Move the folder created from extraction to /usr/share/phpmyadmin directory.

sudo mv phpMyAdmin-*/ /usr/share/phpmyadmin

Create directory for phpMyAdmin temp files.

sudo mkdir -p /var/lib/phpmyadmin/tmp
sudo chown -R www-data:www-data /var/lib/phpmyadmin

We also need to create a directory where phpMyAdmin configuration files will be stored.

sudo mkdir /etc/phpmyadmin/

Copy configuration template to the directory we just created.

sudo cp /usr/share/phpmyadmin/  /usr/share/phpmyadmin/

Edit the file /usr/share/phpmyadmin/ and set secret passphrase:

$ sudo vim /usr/share/phpmyadmin/
$cfg['blowfish_secret'] = 'H2TxcGXxflSd8JwrXVlh6KW4s2rER63i'; 

Configure Temp directory by adding this line in the file.

$cfg['TempDir'] = '/var/lib/phpmyadmin/tmp';

Step 5: Configure Apache web Server

Create a new Apache configuration file for phpMyAdmin.

sudo vim /etc/apache2/conf-enabled/phpmyadmin.conf

Paste below contents to the file.

Alias /phpmyadmin /usr/share/phpmyadmin

<Directory /usr/share/phpmyadmin>
    Options SymLinksIfOwnerMatch
    DirectoryIndex index.php

    <IfModule mod_php5.c>
        <IfModule mod_mime.c>
            AddType application/x-httpd-php .php
        <FilesMatch ".+\.php$">
            SetHandler application/x-httpd-php

        php_value include_path .
        php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
        php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/php-gettext/:/usr/share/php/php-php-gettext/:/usr/share/javascript/:/usr/share/php/tcpdf/:/usr/share/doc/phpmyadmin/:/usr/share/php/phpseclib/
        php_admin_value mbstring.func_overload 0
    <IfModule mod_php.c>
        <IfModule mod_mime.c>
            AddType application/x-httpd-php .php
        <FilesMatch ".+\.php$">
            SetHandler application/x-httpd-php

        php_value include_path .
        php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
        php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/php-gettext/:/usr/share/php/php-php-gettext/:/usr/share/javascript/:/usr/share/php/tcpdf/:/usr/share/doc/phpmyadmin/:/usr/share/php/phpseclib/
        php_admin_value mbstring.func_overload 0


# Authorize for setup
<Directory /usr/share/phpmyadmin/setup>
    <IfModule mod_authz_core.c>
        <IfModule mod_authn_file.c>
            AuthType Basic
            AuthName "phpMyAdmin Setup"
            AuthUserFile /etc/phpmyadmin/htpasswd.setup
        Require valid-user

# Disallow web access to directories that don't need it
<Directory /usr/share/phpmyadmin/templates>
    Require all denied
<Directory /usr/share/phpmyadmin/libraries>
    Require all denied
<Directory /usr/share/phpmyadmin/setup/lib>
    Require all denied

Restriction to specific IP addresses or network address block can be set with a configuration which looks similar to below.

Require ip

Finally restart Apache web server to read the changes.

sudo systemctl restart apache2

Confirm Apache service has been started without any error:

$ systemctl status apache2                                                                                                                                                                                            
● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; disabled; vendor preset: disabled)
     Active: active (running) since Fri 2021-01-22 14:49:54 EST; 11min ago
    Process: 7502 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 7513 (apache2)
      Tasks: 11 (limit: 2274)
     Memory: 57.8M
        CPU: 656ms
     CGroup: /system.slice/apache2.service
             ├─7513 /usr/sbin/apache2 -k start
             ├─7515 /usr/sbin/apache2 -k start
             ├─7516 /usr/sbin/apache2 -k start
             ├─7517 /usr/sbin/apache2 -k start
             ├─7518 /usr/sbin/apache2 -k start
             ├─7519 /usr/sbin/apache2 -k start
             ├─7751 /usr/sbin/apache2 -k start
             ├─7757 /usr/sbin/apache2 -k start
             ├─7758 /usr/sbin/apache2 -k start
             ├─7759 /usr/sbin/apache2 -k start
             └─7760 /usr/sbin/apache2 -k start

Step 5: Open phpMyAdmin Web interface

Access phpMyAdmin Web interface on http://[ServerIP|Hostname]/phpmyadmin

phpmyadmin debian 10 login

Use your database credentials – username & password to login. The root user credentials can also be used to authenticate.

phpMyAdmin dashboard is displayed upon a successful login.

phpmyadmin debian 10 dashboard

You can now use phpMyAdmin for all database management tasks in your software development cycle. Below are more guides we have on Kali Linux.

How To Install GNS3 on Kali Linux Rolling

How To Install AnyDesk on Kali Linux

How To Install Visual Studio Code on Kali Linux

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.



Please enter your comment!
Please enter your name here