In this post we are going to see how to install PHPMyAdmin on a Debian-based operating system like Raspbian on Raspberry Pi.
PHPMyAdmin is a popular free tool for simple management of MySQL/MariaDB databases through a Web interface.
Installing PHPMyAdmin on Raspberry Pi is very simple. Before, we must have installed a Web server like Apache with PHP and a database like MariaDB.
To install PHPMyAdmin from a command line we do,
sudo apt update
sudo apt install phpmyadmin php-mbstring php-gettext
We will be asked a series of questions to configure PHPMyAdmin. First, we select apache2 as the server by pressing SPACE and then ENTER.
Next, we will be asked for the ‘root’ password for the database, and a password to access PHPMyAdmin.
Now we create a new user in the database, which we will use with PHPMyAdmin. To do this, we access MariaDB as root
sudo mariadb -u root -p
And we use the following command to create a user ‘username’ with password ‘password’ (replace with the data you want).
GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' IDENTIFIED BY 'password';
We exit the MariaDB console by doing,
quit
Finally we restart Apache by doing
sudo service apache2 restart
Now we can check that everything works correctly by opening a web browser and going to the address
http://IP/phpmyadmin
That’s how simple it is. PHPMyAdmin is very popular, and it is included in many server installations. In the next post we will see how to install DBeaver, another popular MySQL/MariaDB client. See you soon!