How to install phpmyadmin in Raspberry pi?

Credit to this website:

https://pimylifeup.com/raspberry-pi-phpmyadmin/

Hi All,

I am going to show on how to install phpmyadmin in raspberry pi.

Firstly, we need to make sure we already installed:

  • apache2 web server
  • php and its library
  • install mariaDB also known as mysql

Step 1: Install the PHPMyAdmin

1. To install the PHPMyAdmin package to our Raspberry Pi, we need to run the command below.

sudo apt install phpmyadmin

2. Select the “apache2” option by pressing SPACE and then ENTER. Select this option even if you are using NGINX as we will configure that ourselves latest on.

3. Next, we will need to configure PHPMyAdmin to connect to our MYSQL server. We will also need set up some details so that we can log in to the PHPMyAdmin software.

To do this select “<Yes>” at the next prompt.

Raspbian PHPMyAdmin setup

4. Set a password for PHPMyAdmin itself. It is best to set this password to something different to your root SQL password. Doing this will help secure the server.

This password is what PHPMyAdmin will use to connect to the MySQL server.

Step 2: Creat a new user

5. Create a new user:

sudo mysql -u root -p

6. Run the command below to create a user and permit it to access all databases

Make sure you replace “username” with the username of your choice.

Also, replace “password” with a secure password of your choice.

GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;

7. You can exit out of the MySQL command line interface by typing “quit” in the terminal.

Once done you can proceed to configure PHPMyAdmin for Apache or NGINX.

Step 3: Accessing PHPMyAdmin

1. You should now be able to access your Raspberry Pi’s PHPMyAdmin interface from a web browser.

http://localhost/phpmyadmin

DONE !!!