Using PHPMyAdmin to manage MySQL databases

Monday, 11 August 2008 01:13
Print PDF

PHPMyAdmin is a free tool used to manage MySQL databases. You can access PHPMyAdmin directly from your cPanel>>Databases tab.

Common tasks that can be done using PHPMyAdmin include:
  • Introduction to PHPMyAdmin
  • Create a new table in a MySQL databse
  • Rename MySQL tables
  • Delete a table in a MySQL database
  • Add a field to a database table
  • Modify a table field
  • Delete a table field
  • Importing a MySQL database to your hosting account
  • Exporting (backup) a MySQL database
  • Search a database using PHPMyAdmin
  • Running MySQL queries

You can access your MySQL account using phpMyAdmin using the link provided to you --something like below where  my-domain.ca  is your domain name http://www.my-domain.com/phpmyadmin/

When you click on the link above, a dialog box will prompt you for a username and password. This will be the username and password given you when we set  it up for you.

login

Once you log in, a phpMyAdmin screen appears as shown below.

phpmyadmin

Creating a table in your database

The left-hand frame in phpMyAdmin is used for navigation.You will see your database displayed here (in this case called mydomain). As you create tables, they will show below this.

Click on your database the navigation frame and a new window will appear on the right hand side.

phpmyadmin2

We will create a table in the database, called "people". Use the Create new table feature. Type in the name of the new table into the Name: people, and the number of columns in the table (4) into Fields:. This tutorial is only designed to show you the basic php/MySQL/phpMyAdmin functions. You can delete it using the Drop function. You will want to allow for growth in your table.

phpmyadmin3

Click Go and you should see something like this. The table title now appears with under the database name.

phpmyadmin5

Now enter the names and attributes of our table fields. Enter the following information as above:

Field Tpye Length Default Extra
id int 6 0 auto_increment
name char 100

telephone char 50

birthday char 50

The Length value indicates the maximum allowable length of characters for input. There are many different values that can be set for Type; see further documentation here. The Types specified in this example aren't the most efficient, but just used for the purposes of this exercise. The "id" field, which will be used as a Primary key for this table, has been set to auto_increment, saving you from having to having to type in the next number in sequence when you input records.  Set the Default to 0

Once you've entered all the values, click Save. A screen like this will appear.

phpmyadmin6

Congratulations!-You have created your table! The corresponding SQL command for creating these fields is also displayed. This isn't needed but in time you will start to recognise MySql commands
Note that you can use Drop to delete a table or fields.

When you are ready we suggest you check out  all of the options on this page.

Inputting data into the table.

Click the tab labeled "Insert" -  and another window should appear, like this.

phpmyadmin7

Now type in the details for each of the fields for this record. The "id" column was set to automatically increment so you do not need to enter a number.

Note - if you ever get lost with phpMyAdmin navigation  click "Home" in the left hand nav bar and start again.

Now click Save and the record is saved to the people table.
The previous window reappears with the SQL command for the insert. You can keep adding recordsby re-selecting Insert".
For multiple records, you can select the "Insert another new row" radio button on the input form.

When you've finished entering  several records into the table, you can check them by clicking on the  Browse tab. You can click on  individual records for editing or deleting.

phpmyadmin8

You can use the Select tab to refine your display when your database starts grows to many pages of records.

Last Updated on Thursday, 04 November 2010 07:27
You are here:   Home Section Blog cPanel Using PHPMyAdmin to manage MySQL databases Find us on Google+

Control Panels

News and Events

Our Clients