====== phpMyAdmin ======
===== Installation =====
- Download the latest [[https://www.phpmyadmin.net/downloads/|phpMyAdmin]] from the Downloads page, scroll down to the table with download links for the latest stable release, and copy the download link ending in tar.gz:$ wget https://files.phpmyadmin.net/phpMyAdmin/5.2.0/phpMyAdmin-5.2.0-english.tar.gz
- Unzip the tarball, then move the folder to a local folder outside of apache's document root (we will create a path alias in phpMyAdmin's ''apache.conf'' later) and set ownership:$ tar xvf phpMyAdmin-5.2.0-english.tar.gz
sudo mv phpMyAdmin-5.2.0-english/ /home/user/html/phpMyAdmin
$ sudo chown -R www-data:www-data /home/user/html/phpMyAdmin
- To upgrade to a newer version simply download the new version and extract it to the same folder. Files created by the user will remain the same, e.g. ''apache.conf'', ''config.inc.php'', and ''htpasswd.setup''.
* __Note__: up to Debian 9, and in other distributions, phpMyAdmin could be installed via the package manager. Debian 10 dropped support to install through the package manager.
===== Configuration =====
- We will not use any of the standard path used in Debian versions up to 9 or in other distributions. All files related to phpMyAdmin will remain in the custom path where we moved the downloaded files which is the easiest way for maintenance and later version upgrades (''/home/user/html/phpMyAdmin'').
- Make a new directory for phpMyAdmin to store its temporary files:$ sudo mkdir -m770 /home/user/html/phpMyAdmin/tmp
- Copy ''config.sample.inc.php'' to ''config.inc.php'' and edit as follows
- Use the [[https://phpsolved.com/phpmyadmin-blowfish-secret-generator/?g=6330fef62b5a1|phpMyAdmin blowfish secret generator]] to create a new secret passphrase for cookie authentication:$ sudo vim /home/user/html/phpMyAdmin/config.inc.php
$cfg['blowfish_secret'] = 'new 32 byte secret key';
- Add the following custom settings to ''config.inc.php'':$cfg['FirstLevelNavigationItems'] = 150; // number of databases in navigation, default: 100
$cfg['MaxNavigationItems'] = 150; // number of tables in db navigation, default: 50
$cfg['NavigationWidth'] = 300; // width of the navigation window, default: 240
$cfg['RetainQueryBox'] = true; // retain query box, results of query shown below box, default: false
$cfg['ShowPhpInfo'] = true; // show phpinfo link on home screen, default: false
$cfg['TempDir'] = '/home/user/html/phpMyAdmin/tmp'; // you may omit this line as the default is ./tmp
- You may check [[https://docs.phpmyadmin.net/en/latest/|phpMyAdmin’s documentation]] for other settings to add
- Leave the commented out settings in ''config.inc.php'' unchanged. The ''pma'' settings are better done within phpMyAdmin, where you click "Find out why" in the warning at the bottom of the screen when you first run phpMyAdmin, and then create the database ''phpmyadmin'' which will contain those settings.
- Create ''/home/user/html/phpMyAdmin/apache.conf'':# phpMyAdmin default Apache configuration
Alias /phpmyadmin /home/bco/html/phpMyAdmin
Options SymLinksIfOwnerMatch
DirectoryIndex index.php
AddType application/x-httpd-php .php
SetHandler application/x-httpd-php
php_value include_path .
php_admin_value upload_tmp_dir /home/bco/html/phpMyAdmin/tmp
php_admin_value open_basedir /home/bco/html/phpMyAdmin/:/usr/share/
# Authorize for setup
AuthType Basic
AuthName "phpMyAdmin Setup"
AuthUserFile /home/bco/html/phpMyAdmin/htpasswd.setup
Require valid-user
# Disallow web access to directories that don't need it
Require all denied
Require all denied
Require all denied
# Secure access to phpMyAdmin by restricting access to it's parent, for example by IP address or domain name, local or external
Require ip 127.0.0.1
Require forward-dns ddns.domain.name
- You can replace the directives for the setup directory with ''Require all denied'' as we will not use the setup script. However, if you do want to use the setup script prior to creating ''config.inc.php'', first create the password file to access the setup script's directory:$ sudo htpasswd -c /home/user/html/phpMyAdmin/htpasswd.setup user
- Symlink the configuration file for Apache and restart the service:$ sudo ln -s /home/user/html/phpMyAdmin/apache.conf /etc/apache2/conf-enabled/phpmyadmin.conf
$ sudo service apache2 restart
- Create a regular MariaDB user for the purpose of managing databases through phpMyAdmin, if you haven't done that yet when configuring MariaDB. You could create a user that has privileges to all tables within the database, as well as the power to add, change, and remove user privileges, with this command. Whatever privileges you assign to this user, be sure to give it a strong password as well:$ sudo mariadb
MariaDB [(none)]> CREATE USER 'user'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> exit
- Make sure permissions are set to traverse directories, particularly ''/home/user/html/'' and ''/home/user/www/''
===== Run phpMyAdmin =====
- Access phpMyAdmin by appending ''/phpmyadmin'' to any website url hosted on the same server.
===== Links =====
* [[https://www.how2shout.com/linux/how-to-install-phpmyadmin-on-debian-11-bullseye-apache/|How to Install phpMyAdmin on Debian 11 Bullseye (Apache)]]
* [[https://www.howtoforge.com/how-to-install-and-secure-phpmyadmin-on-debian-11/#install-and-configure-phpmyadmin|How to Install and Secure phpMyAdmin on Debian 11]]
* [[https://docs.phpmyadmin.net/en/latest/config.html|phpMyAdmin Configuration]]
* [[https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-on-debian-9|How To Install and Secure phpMyAdmin on Debian 9]]
* [[https://www.digitalocean.com/community/tutorials/how-to-install-phpmyadmin-from-source-debian-10|How To Install phpMyAdmin From Source on Debian 10]]
* [[https://computingforgeeks.com/install-phpmyadmin-with-apache-on-debian-10-buster/|How To Install phpMyAdmin with Apache on Debian 10]]
* [[https://devanswers.co/problem-php-7-2-phpmyadmin-warning-in-librariessql-count/|Problem with phpMyAdmin and PHP 7.2]]
* [[https://devanswers.co/manually-upgrade-phpmyadmin/|How to Manually Upgrade phpMyAdmin]]
* [[https://www.phpmyadmin.net/downloads/|Download phpMyAdmin]]
* [[https://www.itaewonpool.org/phpmyadmin/doc/html/faq.html#faq1-16|phpMyAdmin trouble shooting]]