Home » Systems » Ubuntu » Installing phpMyAdmin in Ubuntu

Installing phpMyAdmin in Ubuntu

Installing phpMyAdmin in Ubuntu is fairly easy. It involves using apt-get, determining the web server you want to configure it for, which in this case is apache2 and having the password of the MySQL database user you are configuring it for. You will also have to add a line of code in your apache2 configuration so it knows to include phpMyAdmin it in it’s web server.

Installing phpMyAdmin

So lets get started, let’s begin with installing phpMyAdmin through the terminal.

Type the following line to start installing phpMyAdmin.

sudo apt-get install phpmyadmin

Continue with typing Y once the installation prompts you with Do you want to continue [Y/n]? Like in the image below.


Now we are prompted with selecting our web server, in our case we are selecting apache2 like shown below.


Select <Yes> as we just want a basic installation like shown below.


Enter in your MySQL’s root user password like shown below.


Once again enter in your MySQL’s root user password to confirm it as follows.


Now provide a password for phpMyAdmin to use. So that it can register with the MySQL database itself. (Doesn’t have to be the same as the MySQL root user)


Enter in the phpMyAdmin password you created in last step to confirm it as follows.


phpMyAdmin is now installed if you reach this screen, but we have a few more things to do still.


We now need to include phpMyAdmin in the apache2 configuration file

Lets first open the the file by typing the following line.

sudo vi /etc/apache2/apache2.conf


Press the “Page Down" key on your keyboard or use the arrow keys to go to the very bottom of the configuration file until you see a screen similar to below.


Type in the following line to include phpMyAdmin within the apache2 configuration file.

Include /etc/phpmyadmin/apache.conf

Once you type in that line above save the file.


Now lets restart apache2 with the following command so that apache2 restarts and applies the edit we just made.

sudo /etc/init.d/apache2 restart


If you end up with screen similar to above with the [ OK ] that means we are good to go! If you ended up with something different it is probably because you misspelled the line we added earlier. Go back and double check that it is indeed correct.

Testing phpMyAdmin

Now we will test phpMyAdmin! Open up a web browser of your choice and browse to:

http://localhost/phpmyadmin/ or http://IPOFYOURSERVER/

Note: Only use localhost if you on that computer at this time or else you won’t see anything as you are browsing locally!

If you end up with a page that has the phpMyAdmin logo we are good to go on.

Now lets login, the default username for phpMyAdmin is root and the password you need is what you selected earlier. Enter as follows.

Username: root

Password: What you selected earlier

Select Go to login.


You are now logged into your phpMyAdmin through your web browser!


As you can see installing phpMyAdmin in Ubuntu is easy! Remember you can always check out the official phpMyadmin website here for more details.

I have added a gallery below for additional support.

This slideshow requires JavaScript.

About Tyler Bailey

Tyler Bailey is a university student who owns and runs draalin.com. Follow me on
  • Steve

    Great article!
    This could be followed-up or expanded on by adding solutions to a few common requests:
    1. Setting up phpMyAdmin to work with SSL on Ubuntu.
    2. Setting up phpMyAdmin to access additional/remote servers on Ubuntu.
    3. Setting up phpMyAdmin’s extra “pma” features (e.g., bookmarks and PDF page exports) on Ubuntu.

    I’ve been trying to research these things all day, and as far as the generic Ubuntu phpMyAdmin install your article is easily my favorite. Getting your treatment on these other points would be fantastic.

    • draalin

      I have been thinking about writing up one for SSL, not too sure about #2 or #3 in your list though!

      Happy this helped you though, I tried to make it as basic as I could!

  • Will

    You have a mistake in your article.

    Include /etc/phpmyadmin/apache2.conf

    should read Include /etc/phpmyadmin/apache.conf

    • draalin

      Good catch, I was redoing this guide on a virtual machine so it would look cleaner. I updated it, sorry!

  • Thanks so much for this tutorial! It kept me from pulling my hair out literally! I can’t see why hosting companies don’t include tutorials like this one in their help pages… Cheers!

    • draalin

      Glad it helped you out!

  • Himanshu

    You are a life saver man! Thank you for the awesome tutorial!

  • dushyant joshi

    Only one word “Awesome”. Thanks for your all efforts

  • Sam

    Question: after adding the line “Include /etc/phpmyadmin/apache.conf” and restarting apache, I get this error: “The Alias directive in /etc/phpmyadmin/apache.conf at line 3 will probably never match because it overlaps an earlier Alias.” I removed the line and the error went away and phpmyadmin still works.
    After googling it seems that apache already loads /etc/phpmyadmin/apache.conf
    How does it know to load that file?

  • Pingback: Setting up ubuntu server 14.01 with LAMP for WordPress | 3am Coder()