IntroductionWhile many users need the functionality of a database management system like MySQL, they may not feel comfortable interacting with the system solely from the MySQL prompt.
phpMyAdmin was created so that users can interact with MySQL through a web interface. In this guide, we'll discuss how to install and secure phpMyAdmin so that you can safely use it to manage your databases from an Ubuntu 16.04 system.
PrerequisitesBefore you get started with this guide, you need to have some basic steps completed.
First, we'll assume that you are using a non-root user with sudo privileges, as described in steps 1-4 in the initial server setup of Ubuntu 16.04.
We're also going to assume that you've completed a LAMP (Linux, Apache, MySQL, and PHP) installation on your Ubuntu 16.04 server. If this is not completed yet, you can follow this guide on installing a LAMP stack on Ubuntu 17.04.
Finally, there are important security considerations when using software like phpMyAdmin, since it:
- Communicates directly with your MySQL installation
- Handles authentication using MySQL credentials
- Executes and returns results for arbitrary SQL queries
Once you are finished with these steps, you're ready to get started with this guide.
Step One — Install phpMyAdminTo get started, we can simply install phpMyAdmin from the default Ubuntu repositories.
We can do this by updating our local package index and then using the
aptpackaging system to pull down the files and install them on our system:
This will ask you a few questions in order to configure your installation correctly.
- sudo apt-get update
- sudo apt-get install phpmyadmin
- sudo ln -s /usr/share/phpmyadmin /var/www/html/
- sudo apt-get install php7.0-mbstringGRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY 'root_password' WITH GRANT OPTION;
Recargamos los privilegios:FLUSH PRIVILEGES;
Warning: When the first prompt appears, apache2 is highlighted, but not selected. If you do not hit Space to select Apache, the installer will not move the necessary files during installation. Hit Space, Tab, and then Enter to select Apache.
- For the server selection, choose apache2.
- Select yes when asked whether to use
dbconfig-commonto set up the database
- You will be prompted for your database administrator's password
- You will then be asked to choose and confirm a password for the
/etc/apache2/conf-enabled/directory, where it is automatically read.