While 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 on Ubuntu 14.04.
Before 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 14.04.
We’re also going to assume that you’ve completed a LAMP (Linux, Apache, MySQL, and PHP) installation on your Ubuntu 14.04 server. If this is not completed yet, you can follow this guide on installing a LAMP stack on Ubuntu 14.04.
Once you are finished with these steps, you’re ready to get started with this guide.
To 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 apt packaging system to pull down the files and install them on our system:
sudo apt-get update sudo apt-get install phpmyadmin
This will ask you a few questions in order to configure your installation correctly.
For the server selection, choose apache2. Note: 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.
Select yes when asked whether to use dbconfig-common to 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 phpMyAdmin application itself. The installation process actually adds the phpMyAdmin Apache configuration file into the /etc/apache2/conf-enabled/ directory, where it is automatically read.
The only thing we need to do is explicitly enable the php5-mcrypt extension, which we can do by typing:
sudo php5enmod mcrypt
Afterwards, you’ll need to restart Apache for your changes to be recognized:
sudo service apache2 restart
You can now access the web interface by visiting your server’s domain name or public IP address followed by /phpmyadmin:
You can now log into the interface using the root username and the administrative password you set up during the MySQL installation.