PhpMyAdmin on Ubuntu 10.10 with apache2 and php5

Let us install PhpMyAdmin on your machine. You know, PhpMyAdmin is the coolest way to view your database, easy to modify, see the table structure and even search around your tables if you have got a hundred of them in a single database. This web based tool helps fasten our development heavily by saving a lot of time. I will oppose this installation only for one reason, coz you will forget how to write an sql query to fetch data. But if you want, PhpMyAdmin gives provision to give query on your own, in it. So let us move on to the installation part.

We need a couple of packages to get this Installation work. Let me assume you have mysql. If you don’t have it, install it first.

Get all required support packages using

apt-get install php5 apache2 php5-mysql libapache2-mod-php5

We are using apache2 to host this web application, and php5, as PhpMyAdmin is a Php application
php5-mysql is the set of libraries that provides the connection with mysql for the php application. libapache2-mod-php5 helps apache compile php code and render html in your browser. Understand, if after the installation is completed and you are pointing to phpmyadmin from browser and the php file is offered for download by the browser, instead of viewing html, libapache2-mod-php5 is not installed well. But if you are sure you have installed it well, then try running


on your command prompt. This is to enable the php module for apache.

Download latest PhpMyAdmin package, unzip it and move it to /var/www/ directory of your file system. This is where the sites hosted via apache are defaulted to.

now we have a directory /var/www/phpmyadmin/ with contents inside the package in this directory.
For more clarity the index file inside your phpmyadmin package downloaded must look like this


Now I’m going to walk you through the easiest way of configuring your application, but easy means less safe. But for a normal home use this would be enough. Don’t share your sql password with any as your application will be available to anyone who knows your IP address. Create a file

/var/www/phpmyadmin]$ vim

and copy this code into it and make the required changes. That is enter your mysql username and password in the place of your-mysql-username and mysql-password-for-the-above-user respectively

$cfg['Servers'][$i]['user']          = 'your-mysql-username';
$cfg['Servers'][$i]['password']      = 'mysql-password-for-the-above-user';
$cfg['Servers'][$i]['auth_type']     = 'config';

auth_type config is the easiest type to go with a home installation. Save and Exit.

Now go to /etc/apache2/sites-available/ and copy file default to a file phpmyadmin.

 $ cd /etc/apache2/sites-available/
/etc/apache2/sites-available  $ cp default phpmyadmin 
vim phpmyadmin

edit the phpmyadmin file you created now in /etc/apache2/sites-available to look like this.

/var/www/phpmyadmin]$ <VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www/phpmyadmin
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        <Directory /var/www/phpmyadmin>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all

you dont have to copy this and paste, instead just go to your phpmyadmin file and edit DocumentRoot to look like the above, that is let it direct to /var/www/phpmyadmin, your application’s root path.

Rest in that file is itself a matter for a blog, but not this time. Coz now your phpmyadmin is waiting for you.
Direct your web browser to http://localhost/phpmyadmin

Have happy time with Mysql!!!!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s