Click to find out more about our Work
July 25th, 2008

Tutorial : Using phpMyAdmin to manage mySQL

10 Comments

Hello Everyone !

I am really excited ! Its been 18 days since the blog started and the response is amazing. I really hope these tutorials are helpful. Anyways I have seen a lot of people having problem setting up phpmyadmin and Lot more have no idea how to use it. So this tutorial is dedicated to you folks. I`ll teach you the basics of how to play with phpMyAdmin. Frankly I have not seen much tutorials on how to use phpmyadmin, and I don`t know how well you guys will like it.
Anyways

phpMyAdmin 2.11.x Front Page

phpmyadmin front page


The Front page shows you something similar to the above image. As you can see, On the left we have the existing databases. If there are none available its fine, and on the right we have the page which has a lot of text in it :P . You can see that I have marked the area from where you can create your database.
For more information about your mysql server, its configurations etc you can check the many links on this page. Exploring more links is the key to master it ;)

Lets create a database called ‘test’

Now lets create a database called test. Put the name test in the Create New database box and click on create.

Create dbase screen using phpmyadmin

You`ll see something similar to the above when you create your first database. Cool ! Now you might notice that I have boxed an area in the above image.

  • Structure – Shows you the structure of the database (Schema)
  • SQL – You can use the query language to modify your database
  • Search – Search for a particular item
  • Query – Right now don`t worry about this much. :)
  • Export/Import – You can export your database in SQL or import an equivalent
  • Operations – Operations you can perform on your database
  • Privileges – Shows you the user who can use this database and his privileges.
  • Drop – Delete the database

Phew that was quite a bunch ! Lets move on. Now we have created our database test. Lets create tables in it. Click on SQL from the area I had marked in the image, and goto the next step.

Create table ‘user’

create table in phpmyadmin

You will see a page similar to the above image. Write a SQL query to create a table.

CREATE TABLE user (
id INT AUTO_INCREMENT NOT NULL,
user VARCHAR(50),
pass VARCHAR(50),
PRIMARY KEY(id) )

phpmyadmin table code executed

If the code was executed successfully you`ll see something similar to the above image. I think the image is self explainatory. On the left the table you just created under database test. Click on ‘test’. you will be taken to the ‘Table Info Page’.

phpMyAdmin Database Info page

phpmyadmin database info page

This page is where all your tables of a particular database are shown. As shown in the above figure, in the database test, we currently have only 1 table i.e user.

phpMyAdmin Table Info page

phpmyadmin table page

Ok ! So you clicked on test and something similar to the above image will be displayed. This page shows you the structure of your table. As you can see, the table we had created has 3 attributes

  • id -int (Primary key)
  • user -VARCHAR of size 50
  • pass – VARCHAR of size 50

You can see in the above image, I have marked an area “edit the attributes”. Those little icons help to modify your attributes. From the Left -

  • Browse – Browse values of a particular attribute
  • edit – Edit structure of attribute, (example: change particular attribute’s datatype from VARCHAR to text)
  • delete – delete particular attribute
  • Primary, Unique, Index. (It is pretty self explainatory, if you know anything about DBMS)

Insert values inside table

Ok, Now you know how to create a database, create table inside a database. Lets learn how to insert values inside our table. First goto the ‘user’ ‘table info page’. then Click on Insert in the top.

insert page phpmyadmin

You`ll see a page similar to the above image. As you can see, its pretty neatly laid out, I hope its not that tough for you to decide where to type your data ;) *There is no need to type anything in id, since if you notice this line
id INT AUTO_INCREMENT NOT NULL which we had typed earlier to create a table ,you`ll see that id is a primary key & it auto increments as you go on inserting records.*

inserted values

The above image will be displayed once you have inserted your values successfully. Now since you have inserted values, you can double check or see what all values your table contains by clicking on the Browse link on the top. It`ll browse the table for all the records. The following image is what it`ll look like.

phpMyAdmin Table browse page

phpmyadmin browse all records

You can see all the values for every record. You can edit, delete the records as well. The small Icons are very obvious and not hard to miss. PhpMyAdmin also gives the ability to see results for particular queries. Suppose you want to execute a query on a particular table then click on SQL on the top of the ‘Table Info/Browse Page’

Execute SQL queries on your table

phpmyadmin sql query

The above page is how it`ll look like, you can type in any query to check.

Well, that was very basics of phpMyAdmin. If you guys want any help regarding other functions of phpmyadmin feel free to ask.

If the response for this tutorial is well, then I`ll move to the advanced phpmyadmin stuffz :) . Enjoy Guys

10 Responses to “Tutorial : Using phpMyAdmin to manage mySQL”

  1. kani alavi
    October 29, 2009 at 9:34 am

    the tutorial is very simple ,easily comprehensible and straight forward. thank you for this wonderful tutorial. i am really looking forward for the advanced phpmyadmin stuffz you talk about. continue the good work

  2. anivad
    April 2, 2009 at 6:33 pm

    Nice clear tutorial, thanks.

    Need advice on best practices for importing /exporting database. Especially partial database imports (server timeouts)
    Have problem: working on localhost getting server timeout. already configured php.ini for max execution times & all the rest… 00 (no time limit) also tried 600 (seconds)
    Getting half imported databases.

    Wanting to know where to find the # of records/queries successfully executed (imported) , so as to continue import from that # avoiding duplicate table inserts??

    Yours seems to be the most newbie sensitive site. Any suggestions would be much appreciated.
    -cheers

  3. Pat
    January 19, 2009 at 6:04 pm

    I found this tut very helpful. I would like to see a tut on making an image database using PhPMyAdmin and MySQL. I just started using the XAMPP package on my Vista machine. I want to create a web-based front end with a thumbnail gallery linked to the image and a admin style back end to up load and name the images.
    I have been googling for more than a day now. Your tut is by far the best I have seen! Looking forward to your response.

    Pat

  4. Ewan
    December 29, 2008 at 6:41 pm

    Guys talking about mysql front end tool then please check this out sqlyog an amazing db administrative tool offered under open source just for free. You find the best in it.

  5. Nick
    November 11, 2008 at 9:17 pm

    That’s all good… but how do you even get to the first place?

  6. Michael
    August 2, 2008 at 11:23 pm

    Hey kani alavi,
    Thanks for posting in. Definately I`ll write about the advanced features in phpmyadmin soon.

    Regards

  7. kani alavi
    August 2, 2008 at 6:11 pm

    the tutorial is very simple ,easily comprehensible and straight forward. thank you for this wonderful tutorial. i am really looking forward for the advanced phpmyadmin stuffz you talk about. continue the good work

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code lang=""> <del datetime=""> <em> <i> <p> <q cite=""> <strike> <strong>