This guides presents a simple way of how to Install phpMyAdmin on FreeBSD 12. phpMyAdmin is a free and opensource tool written in PHP for managing MySQL and MariaDB tasks such as creating, altering, dropping, deleting database tables or running any other database management commands over the web interface.
phpMyAdmin comes bundled with a handful features which you can check them from here.
In order to use phpMyAdmin, you need to have a FAMB (Apache, MySQL, PHP) installed on your FreeBSD 12 server. You can kindly follow our previous link on how to setup FAMB Stack on FreeBSD 12.
Install the required PHP extensions if you have not done so already;
pkg install php72-mysqli php72-json php72-mbstring php72-session php72-hash
You can verify the presence of the above PHP extensions by running the command below;
php -m | egrep "json|mbstring|session|mysqli|hash" hash json mbstring mysqli session
Assuming you have FAMB Stack with the necessary PHP extensions up and running, proceed as follows;
Download phpMyAdmin package
In order to get the latest version of phpMyAdmin running on your server, navigate to the download page and grab the latest package of phpMyAdmin. Even though phpMyAdmin is usually included in most systems default repositories, they may not be up-to-date. You can however check the same to verify. To install phpMyAdmin from the source, you can simply run the command below to download the current release version 4.8.4
Verify that the downloaded file is not corrupted by comparing that SHA256 hash for the two files matches. From the phpMyAdmin download page, the SHA256 has for the
6f4e1791392a9e46e81b679fb65bf49e2c1c54f3845001b837d4a4cc4cbfbb46. To check the SHA256 for the downloaded file, run the command below;
sha256 phpMyAdmin-4.8.4-english.zip SHA256 (phpMyAdmin-4.8.4-english.zip) = 6f4e1791392a9e46e81b679fb65bf49e2c1c54f3845001b837d4a4cc4cbfbb46
Great, the hashes match and we are good to proceed.
Install phpMyAdmin on FreeBSD 12
Unzip the phpMyAdmin package downloaded above and move it to Apache Web Root directory,
mv phpMyAdmin-4.8.4-english /usr/local/www/apache24/data/phpmyadmin
phpMyAdmin has been installed and thus can be configured as follows;
Navigate to the
/usr/local/www/apache24/data/phpmyadmin and rename the PHP configuration file.
cp config.sample.inc.php config.inc.php
/usr/local/etc/php.ini and add the following lines to load the extensions installed above.
extension=mysqli.so extension=mbstring.so extension=json.so extension=session.so
Save and quit the file.
tmp folder for caching templates and set proper permissions;
chmod 777 /usr/local/www/apache24/data/phpmyadmin/tmp
Create a blowfish secret required for cookie based authentication to encrypt password in cookie. You can generate the secret and paste as follows;
... /** * This is needed for cookie based authentication to encrypt password in * cookie. Needs to be 32 chars long. */ $cfg['blowfish_secret'] = '$2a$07$jCKBmwSU0iyKGpwsHQUAVOuH5Kh37h52cT5.RLZrvN3tiHO67b1J.'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */ /** ...
Restart Apache for the changes to take effect.
service apache24 restart
To access phpMyAdmin dashboard, navigate to the browser and enter the URL in the format,
http://server-IP/phpmyadmin. This will take you to phpMyAdmin login page.
Login with MySQL database root credentials.
If you are running MySQL 8.0 then you might have an issue with logging in to phpMyAdmin dashboard, see the error below. Note that MySQL 8.0 is using
caching_sha2_password rather than
mysql_native_password as the default authentication plugin which phpMyAdmin may not understand.
As a work around, login to your MySQL as root user and run the command below to change the Authentication Plugin for the root user to
mysql_native_password as shown below;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '[email protected]';
Restart MySQL and go back to the browser and login to your phpMyAdmin dashboard.
There you go. You have successfully gone through a guide on how to install phpMyAdmin on FreeBSD 12. Enjoy!
You can also check our previous articles on LAMP/LEMP Stack using the following links;