PhpMyAdmin

Updated 21 March 2019

We suggest installing PhpMyAdmin from the source.

Creating the paths

Create the necessary directories:

mkdir -p /var/www/pma/{logs,upload,save}"

Downloading the source code

Note

Before downloading, look up the latest stable version on phpmyadmin.net.

Then go to the archive location on the developer's site and get it:

cd /var/www/pma

wget https://files.phpmyadmin.net/phpMyAdmin/4.7.5/phpMyAdmin-4.7.5-all-languages.zip

You may need to install Unzip to extract the archive:

emerge -a unzip

Now extract the files:

unzip /var/www/pma/phpMyAdmin-4.7.5-all-languages.zip -d /var/www/pma

Rename the phpMyAdmin-4.7.5-all-languages directory to htdocs:

mv /var/www/pma/phpMyAdmin-4.7.5-all-languages /var/www/pma/htdocs

Define the necessary permissions for the pma directory and all nested files and directories:

chown -R nginx:nginx /var/www/pma

PhpMyAdmin configuration file, handled by Nginx:

PhpMyAdmin uses http and its domain name is pmalempcss.calculate.loc. Create the configuration file /etc/nginx/conf.d/pma.conf and edit it as shown below:

etc/nginx/conf.d/pma.conf

nginx
# pmalempcss.calculate.loc
server {
    listen 80;
    server_name pmalempcss.calculate.local;
    access_log /var/www/pma/logs/pma.access_log main;
    error_log /var/www/pma/logs/pma.error_log info;
    root /var/www/pma/htdocs/;
    index index.php index.html index.htm;
    location ~ \.php$ {
           try_files $uri =404;
           include /etc/nginx/fastcgi.conf;
           fastcgi_pass unix:/run/php-fpm.socket;
       }
}

After the Nginx configuration file has been created, check it and restart the service:

nginx -t

/etc/init.d/nginx reload

Add the necessary data to the DNS server of the local network or edit /etc/hosts on the local computer that will be used for the connection:

/etc/hosts

192.168.0.10 pmalempcss.calculate.local

Creating a phpMyAdmin configuration file

If you type http://pmalempcss.calculate.loc/setup, a page with options will open and the PhpMyAdmin configuration file will be saved.

Important

When config.inc.php has been added to the site root directory, access to it will be closed.

Here is a sample configuration file.

/var/www/pma/htdocs/config.inc.php

<?php
/*
 * Generated configuration file
 * Generated by: phpMyAdmin 4.7.5 setup script
 * Date: Sat, 18 Nov 2017 15:51:14 +0000
 */
/* Servers configuration */
$i = 0;
/* Server: localhost [1] */
$i++;
$cfg['Servers'][$i]['verbose'] = '';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
/* End of servers configuration */
$cfg['DefaultLang'] = 'ru';
$cfg['blowfish_secret'] = '5"+y&lt;2TqP+qrobW`%c!!9"BRYdIVZGIL';
$cfg['ServerDefault'] = 1;
$cfg['UploadDir'] = '/var/www/pma/upload';
$cfg['SaveDir'] = '/var/www/pma/save';
?&gt;

Configure the access rights for the configuration file:

chown nginx:nginx /var/www/pma/htdocs/config.inc.php

To work with databases, go to ~http://pmalempcss.calculate.loc~~ in your web browser.
Once the root login and password specified during the initial configuration of MariaDB, you will be directed to the main PhpMyAdmin page, where you will be able to freely manage your databases.