How to Install and Secure phpMyadmin on Ubuntu 16.04

According to a report by Gartner,  open source databases are quickly consuming the market share of commercial relational database management systems (DBMSs).

MySQL is one of the most preferred databases and has matured enough over the years to replace commercial options such as Oracle and Ms SQL. Any application development team can now permanently consider MySQL as their standard choice for holding their production environment data.

However, many system users feel uncomfortable when dealing with MySQL over the command prompt which can be quite challenging.  The best option of managing and interacting with your MySQL database is phpMyadmin.

Let’s see how you can install phpMyadmin on Ubuntu 16.04 VPS server

Prerequisites

Step 1: Update your system and install phpMyadmin from the Ubuntu repository

PhpMyadmin is maintained on the Ubuntu repository, so we are going to use apt-get to pull the package by typing the commands below:

$sudo apt update && sudo apt upgrade

$sudo apt-get install phpmyadmin

Confirm the installation by pressing Y and Enter on the prompt that appears

Step 2: Select your web server

Once the files are installed on the system, you will see an option to configure phpMyadmin. Select [ ] apache as the web server that should be automatically configured to run phpMyadmin.

Step 3:  Configure database for phpMyadmin

On the next screen, you will see an option to configure database for phpMyadmin dbconfig-common, just select Yes and hit Enter to continue.

Step 4: Provide password for phpMyadmin

By default, phpMyadmin requires a database and a password that should be registered with the MySQL server. You should enter a strong password once you get a prompt to provide it and press Enter to continue. Don’t leave it blank. Remember to confirm the password on the prompt that follows.

Step 5: Creating symbolic links

The phpMyadmin Installation process should add a symbolic link to the /etc/apache2/conf-enabled/ directory by default. Sometimes that does not happen. When you try to access PhpMyadmin from the web browser, you will get an error, “Not Found. The requested URL /phpMyadmin was not found on this server.

To create the symbolic link manually, enter the following commands :

sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf

sudo a2enconf phpmyadmin.conf 

sudo service apache2 reload

Step 6: Confirm the installation

Once the installation is completed, you can check whether PhpMyadmin is working by visiting the link below from your browser. Remember to replace www.example.com and  127.0.0.1 with your domain name or IP address respectively.

http://www.example.com/phpmyadmin 
or 
http://127.0.0.1/phpmyadmin

If the installation was successful, you will see the phpMyadmin login page.  You will need to enter your MySQL root password that you defined when Installing MySQL to access your databases.

If something went wrong during the configuration, you can run the command below to re-configure phpMyadmin

sudo dpkg-reconfigure phpmyadmin

Conclusion

Finally, you have configured phpMyadmin to work with MySQL on your Ubuntu 16.04 VPS server. Remember, you can create databases, tables, users, insert, update and delete records on the phpMyadmin interface just like you would normally do on the MySQL command prompt.

For security reasons, don’t configure your websites or applications to run with the MySQL root user. Just create a separate username and a password for each website to safeguard your databases.

Ads by Google

Leave a Reply

Your email address will not be published. Required fields are marked *