7 February 2018

phpMyAdmin - Installation of the Current Version for a Local Web Server

* Manual Installation of the current version of phpMyAdmin from the official website under Linux. Configuration with the setup-script and the configuration wizard.


Tested with KDE neon LTS 5..8.8 - should work as well in Linux Mint 18 and Ubuntu 16.04, on which both distributions are based.

phpMyAdmin can be installed in Ubuntu, Linux Mint and KDE neon via the package manager. But if you prefer the current release, you can download a tar.gz archive from the official website and install the latest phpMyAdmin. Here a tutorial for setting up phpMyAdmin with a local web server and databases on one's own computer.

Installation of the Apache Web Server, PHP and MySQL

Installation of the MySQL server - it is requested to set a password
During installation of the MySQL server a password should be set. You need this later to login to phpMyAdmin.

For the beginning you need to install the basic packages for a local web server. This includes the Apache web server, the scripting language PHP, and the MySQL server. In short form, this is called LAMP (Linux-Apache-MySQL-PHP).

While installing, you will be asked to specify a password for the MySQL server. You may write the password down since you will need it later.

Possibly you have to specify the server as the Apache Server.

sudo apt install apache2 libapache2-mod-php7.0 php7.0 php7.0-mbstring php7.0-mysql mysql-server
sudo service apache2 start

Optional: depending on the project, addotional php modules may be necessary. I like to install them from the beginning. I also activate the Apache module rewrite.

sudo apt install  php7.0-curl php7.0-mcrypt php7.0-gd php7.0-zip php-ssh2
sudo a2enmod rewrite
sudo service apache2 restart

By now the Apache web server should be running. You should be able to access http://localhost seeing the  Apache2 Ubuntu Default Page with the "It work's!" displayed.

Later projects are stored in the /var/www/html directory.
Next, the web server is secured externally. For this purpose, edit the file /etc/apache2/ports.conf with root privileges and change Listen *80 to Listen
Open a terminal. The command

sudo netstat -tulpen

should show that Apache and Mysql are set to[portnumber] (localhost).

tcp        0      0*               LISTEN      118        23214       1178/mysqld  
tcp        0      0  *               LISTEN      0          24123       1352/apache

Installation and Configuration of phpMyAdmin

Download and extract the phpMyAdmin archive

Download the current version of phpMyAdmin from their Download Site. In this case I will use the all-laguages tar.gz file - phpMyAdmin-4.7.7-all-languages.tar.gz.
Also download the checksum and check the downloaded archive.

sha256sum ~/Downloads/phpMyAdmin-x.x.x-all-languages.tar.gz

After that untar the archive to the directory /var/www/html and rename it to phpmyadmin. Change the owner of phpmyadmin to the Apache server.

sudo tar -xzvf ~/Downloads/phpMyAdmin-x.x.x-all-languages.tar.gz -C /var/www/html
cd /var/www/html
sudo mv phpMyAdmin-x.x.x-all-languages phpmyadmin
sudo chown -R www-data:www-data phpmyadmin

Create the file phpmyadmin.conf for the Apache server

In the next step create a file with the name phpmyadmin.conf within the directory /etc/apache2/con-available. You need root rights to do this. The file is a text document with the following content (it may have to e adopted to your own system):

Alias /phpmyadmin "/var/www/html/phpmyadmin"
<Directory "/var/www/html/phpmyadmin">
    DirectoryIndex index.php
    AllowOverride All
    Options FollowSymlinks
    Require all granted

The just created file must be enabled and the Apache server is restarted.

sudo a2enconf phpmyadmin.conf
sudo service apache2 restart

Configuration with the Setup Script and the Configuation Assistant

The setup script of phpMyAdmin is called in the browser under the address localhost/phpmyadmin/setup
With the first call of localhost/phpmyadmin/setup the overview of the configuration assistant shows up. Click on "New server".

Overview: Now you can call up the setup script  localhost/phpmyadmin/setup. There you generate the configuration file config.inc.php which is afterwards saved into the phpmyadmin directory /var/www/html/phpmyadmin. Change the permissions of the file to be more restrictive.

First, open the site localhost/phpmyadmin/setup in your browser. It will setup the configuration assistant. There is much to configure, but the most can be left in the default settings. First the tab "Overview" appeares.
The language can be selected in the drop-down menu at the top right. In the section "Server" click on "New server".

In the configuration assistant of phpMyAdmin a  von phpMyAdmin a new server can be added and configured. The hostname is localhost.
In the basic settings fill in localhost for the hostname. The rest of the fields can be left empty.

Under "Add new server" the first tab is called "Basic settings". In the field "Server hostname" enter localhost. You can leave the rest of the fields blank, then the default settings apply for them.

Choose "cookie" as authentication type to configurate the server.
Choose "cookie" as authentication type in the corresponding tab. If you enter "root" as the user name, the field is already filled in on the login site.

In the next tab "Authentication" select "cookie" for the Authentication type. The user name for config auth is "root".

You may leave out the rest of the fields as well, even the field for the password. In princible, you could enter your password here (the one which you were asked for at the MySQL server installation in the beginning).
On one hand phpMySQL saves the passwords in plain text, on the other the security requirements on a local web server are not so high than in the Internet. In any case you will be prompted for the password on the login page (you can bypass that with choosing "config" for the Authentication type, but I do not recommend this).

Under the tab "Server configuration" make sure "Allow root login" is checked (default). Confirm the configuration by clicking on "Apply". Back in the "Overview" tab download the file onfig.inc.php with a click.

Now move the file to the directory /var/www/html/phpmyadmin, and set the permissions.

sudo mv  ~/Downloads/config.inc.php /var/www/html/phpmyadmin
cd /var/www/html/phpmyadmin
sudo chmod 660 config.inc.php
sudo chown www-data:www-data config.inc.php

Login phpMyAdmin

The login site of phpMyAdmin.
The phpMyAdmin Site. Login with your password which you have given at the installation of the MySQL server.

Now call localhost/phpmyadmin in your browser and after login create and manage databases and users.

If the following warning appears at the bottom of the home page after logging in: " The phpMyAdmin configuration storage is not completely configured, some extended features have been deactivated. Find out why." then just click on the link and on the next page click "Create a database named 'phpmyadmin' and setup the phpMyAdmin configuration storage there.".

That activates the phpmyadmin user with some additional features like bookmarks.




Further reading: Manual "Quick install" on the phpMyAdmin-site.


Add new comment