# Install phpMyAdmin on LAMP (Linux Apache MySQL PHP)

## What is phpMyAdmin?

> phpMyAdmin is a free software tool written in PHP, intended to handle the administration of MySQL over the Web. -https://www.phpmyadmin.net

This tutorial assumes a working Apache2, PHP and MySQL/MariaDB environment is already installed

1. Log into the Linux machine
2. Run the following commands in terminal to install phpMyAdmin:
   # update apt repositories
   sudo apt update
   sudo apt upgrade
   # download latest phpMyAdmin
   wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-english.tar.gz
   # create phpmyadmin directory in web root
   sudo mkdir /var/www/html/phpmyadmin
   # extract the downloaded phpMyAdmin to the folder created
   sudo tar xvf phpMyAdmin-latest-english.tar.gz --strip-components=1 -C /var/www/html/phpmyadmin
   # create a copy of the sample config file
   sudo cp /var/www/html/phpmyadmin/config.sample.inc.php /var/www/html/phpmyadmin/config.inc.php
   # set folder owner
   sudo chown www-data:www-data /var/www/html/phpmyadmin
   # restart apache service
   sudo systemctl restart apache2
   # connect to MySQL and create a user to use with phpMyAdmin
   sudo su
   mysql -u root
   CREATE USER 'i12bretro'@'localhost' IDENTIFIED BY 'some_very_complex_password';
   GRANT ALL PRIVILEGES ON * . * TO 'i12bretro'@'localhost';
   FLUSH PRIVILEGES;
3. Once the installation completes, open a web browser and navigate to http://DNSorIP/phpmyadmin
4. Log in using the user created in the steps above
5. Enjoy visual browser based control over MySQL/MariaDB