Installing phpMyAdmin Manually

From Sympl Wiki
Jump to navigation Jump to search

This guide covers manually installing phpMyAdmin on a server running Sympl Debian Buster, rather than using the packaged version with sympl-phpmyadmin, which uses the version from Debian Backports.

This guide is aimed at moderate-to-experienced users, and as such care should be taken when following it, and assumes you do not currently have the sympl-phpmyadmin or phpmyadmin packages installed at present.

Installing phpMyAdmin

cd to your destination htdocs dir, such as a subdirectory of an existing site (example.com/phpmyadmin), or a separate subdomain (phpmyadmin.example.com)

wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.tar.gz -O - | tar -zxv --strip 1

sympl create database phpmyadmin

cat sql/create_tables.sql | mysql -u phpmyadmin -p$( cat /home/sympl/mysql_phpmyadmin_password ) phpmyadmin

rm -rf setup/ test/

mkdir tmp ; sudo chown www-data:www-data tmp ; sudo chmod 770 tmp

cp config.sample.inc.php config.inc.php

echo "\$cfg['blowfish_secret'] = '$( openssl rand -base64 32 | cut -c 1-32 )';" >> config.inc.php

echo "\$cfg['UploadDir'] = '$(pwd | cut -d'/' -f 1-4)';" >> config.inc.php
echo "\$cfg['SaveDir'] = '$(pwd | cut -d'/' -f 1-4)';" >> config.inc.php

echo -e "AuthType Basic\nAuthName \"Restricted Access\"\nAuthUserFile /home/sympl/phpmyadmin.passwd\nRequire valid-user\n" > .htaccess

Now, set the access up:

touch $(pwd | cut -d'/' -f 1-3)/config/ssl-only # enforce ssl-only mode for the site.
htpasswd -c /home/sympl/phpmyadmin.passwd phpmyadmin # set a password

You should then be able to browse to the site, log in with the username phpmyadmin and the password specified, and then log into individual databases or as the sympl user which has the equivalent of root access.

Things to know

  • Any database dumps will be stores in the sites public directory, and can dumps can be imported from there, also.
  • The password for the sympl database user can be found in /home/sympl/mysql_password.
  • If databases were created with sympl create database, their passwords can be found in /home/sympl/mysql_databasename_password
  • Initial authentication (and users) can be updated in /home/sympl/phpmyadmin.passwd in normal htpasswd format. phpMyAdmin has no automatic updating, so ensure you use a strong password.
  • The safest way to update phpMyAdmin at present would be to follow these instructions again.