Install phpMyAdmin on Ubuntu Linux

In an ealier post, we have completed the LAMP stack in order to prepare an Ubuntu server for web hosting. The ‘M’ in LAMP refers usually to MySQL – but lately also to MariaDB.

It is possible to run MySQL entirely from the command line. This is not reallt difficult, but I find myself making too many typos.

Fortunately, there is solution – phpMyAdmin. phpMyAdmin offers a graphical user interface for your day-to-day MySQL management.

In this post, we are going to add phpMyAdmin to the already available LAMP stack.

Installing phpMyAdmin

Login to you server.

In case you have not updated the sources.list earlier today, run:

Type at the prompt:

As you will understand, phpmyadmin is the core program. php5-mcrypt is an encryption module. The installation of the module will be skipped, in case the module has been installed already.

When you are asked whether you want to continue, hit Enter.

phpMyAdmin select webserver

A configuration screen pops-up where you to select your webserver. We have installed Apache, so select ‘apache2’, by clicking the space bar.

Jump to <Ok>  with the Tab key and hit Enter.

phpMyAdmin dbconfig-commonA second screen appears. Hit Enter to select <Yes>.

phpMyAdmin root passwordEnter your MySQL password at the third – and last screen.

Last but not least, we have to ensure us that the mcrypt module has been enabled:

Finally, we need to reload the Apache configuration now that we have enabled a new php5 module:

That is it. You have finished the installation of phpMyAdmin.

You can access phpMyAdmin through the address bar of your browser:

Just replace the variable $serverip with the IP address of your server.

Changing the Default phpMyAdmin URL

The default hyperlink to access phpMyAdmin has one drawback. It is default and therefore obvious.

Changing the default will increase the security of our  installation. Fortunately, changing the URL is an easy and quick fix.

Enter at the prompt of your server:

We have opened the phpMyAdmin’s configuration file for Apache with the Nano text editor.

The second line in this configuration file reads:

Replace the first phpmyadmin by a word of your choice. Basically, it can be any word acceptable to a browser.

Assuming that you have picked ‘myphpadmin’, the second line would read like this:

Save you file.

Since, we have changed a configuration file, so we have to restart or reload Apache in order for the changes to take effect:


Now you can access phpMyAdmin over the link http://$serverip/myphpadmin. A link that only you are aware of.

And in case you can not recall it someday, just check the apache.conf file.

More Details