Installing phpmyadmin

Sir gave us a new task. I made a form with php bindings in it .Though I wasn’t successful in completing the task,but I learned many new things.

Then I started installing phpmyadmin. Here are my notes:

About phpMyAdmin


phpMyAdmin is an free web software to work with MySQL on the web—it provides a convenient visual front end to the MySQL capabilities.

Phpmyadmin is a free tool used to administrative MySQL database in a GUI mode ( Using web browser ) . You can perform almost all the major tasks like creating , deleting  and modifying databases, tables, rows etc.

In order to install phpmyadmin,you need following three packages. These are:

1. Apache2
2. Mysql
3. PHP

Apache2 installation


Open terminal and write following command on terminal:

$ sudo apt-get install apache2

Open /etc/apache2/httpd.conf . Add the following line “ServerName localhost” .
ServerName localhost
Now,restart the  Apache service  with following command:

$ sudo /etc/init.d/apache2 restart

 Now,paste your ip on browser.You can see the apache2 test page.

Screenshot from 2013-06-11 15:18:41

MySQL installation


Install Mysql server  by typing the below command in terminal .

$ sudo apt-get install mysql-server

Now, window asking  for password will appear.

300x140xinstall_mysql_ubuntu_1-300x140.jpg.pagespeed.ic.3Wtl9g4KdW

 

 Now after installation is complete, check for database connection by following command:

$ sudo /etc/init.d/mysql status
mysql start/running, process 12429

PHP installation


To install it, put this command on terminal:

$ sudo apt-get install php5 php5-mysql

Now to show php configuration,create file and paste the command below there.

Goto the default apache root path /var/www . create a new file phpinfo.php  and paste the below code and save it.

<?php
phpinfo();
?>  

Use this command to restart the apache2

$sudo /etc/init.d/apache2 restart

Now open the browser with http://yourip/phpinfo.php

You can see window like this:

Screenshot from 2013-06-10 13:58:51

Testing all together:


Create a new file dbtest.php in the apache root path (/var/www) and paste the below code .Replace “password” with your mysql root password provided during mysql installation .

<?php
$con = mysql_connect("localhost","root","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
else
{
echo "Yippeee!gurpinder's connection established successfully";
}
mysql_close($con);
?>

open the file in your browser ( http://yourip/dbtest.php ). you can see the page as below.

Screenshot from 2013-06-10 14:42:44

Installing phpmyadmin


After installing apache2, mysql and php, you can continue with the below steps to install and configure phpmyadmin.

Update with following command :

$ sudo apt-get update

To install phpmyadmin,give following command on terminal:

$ sudo apt-get install phpmyadmin

You will prompted to choose the type of web server for phpmyadmin . just choose “apache2″  (use space bar and enter key for selecting ).

now open the path “http://localhost/phpmyadmin” in the browser , you will prompted for username and password.

Screenshot from 2013-06-11 20:17:01

Leave a comment