How to create a database with PhpMyAdmin, add tables, backup and restore it

By | March 8, 2013

Creating a Database through PhpMyAdmin, Adding Tables, Keeping back ups, and restoring Database

In Inway Hosting this chapter of PhpMyAdmin Tutorial, you will learn about How to create a new Database? How to add table with records? How to create a Database back up and restoring database?

Firstly, we will start with creation of Database. We provide FTP Hosting India

Creating a MySQL database

One cannot create a database directly via cPanel –>> PhpMyAdmin but can easily create a database from cPanel –>> My SQL database. Locate New Database Box and enter the database name in that box and click on Create Database option.

Create-Database-01

The name appearing in database will always preceded by cPanel username. For e.g.- if the user name of cPanel is User and database name is Test, then actual database name  created will be  User_Test. Immediately you will get the confirmation message.

Create-Database-02

Adding My SQL Database Table

Execute your cPanel –>> PhpMyAdmin tool to open the newly created Database table as it will remain empty and will not contain any Tables.

Create-Database-03

Enter the table name and the number of fields. Click on the Go button to create the table. On the next screen you should enter the fields’ names and the corresponding properties. The properties are:

For creating a table, enter the table name and no. of fields, click on GO button and proceed. On the next page, enter field’s name and corresponding properties, mentioned below:

Type

Pick the type of data you want to store in given field, If you want more choices, go through My SQL Documentation.

Length/Values

Here you can enter the length of the field. One can enter ‘a’, ‘b’ or ‘c’ depending upon the field type “annum” or “set”.

Collation

For each of the field, one can pick the Data collation.

Attributes

The main attributes possible are:

BINARY – the field collation would be Binary. Like utf8_bin

UNSIGNED – The numeric value of the field will be positive or Zero.

UNSIGNED ZEROFILL – The numeric value of the field will positive, zero or numbers leading zeros.

ON UPDATE CURRENT_TIMESTAMP – Data type field value has a current timestamp set as a default value, which gets updated automatically.

NULL

Here you can know, whether field value is NULL or not, for further knowledge about the same thing, you have to go through My SQL documentation.

DEFAULT

This function allows it users to set a default value for the field.

EXTRA

This function allows you to know, whether field value is auto- increment. The Radio buttons shown below indicates the index defined for exact field and specifies index type.

COMMENTS

In this section, one can add comment, which is included in Database SQL code. At the end one can add Table comments, pick MY SQL storage engines and collations.

After filling all the details, click on save button and proceed.

Create-Database-04

If you want to add more fields click on Add button instead of save.

The new database table will be created, showing the corresponding MY SQL query.

Create-Database-05

And now we can proceed further with filling the table.

Adding Content in database table

Click on insert option, to add more records in database table.

Create-Database-06

Enter all data in respective Field and click on Go button to proceed. You can find a labelled Restart insertion with x rows at the bottom of page in drop down menu. Insert the number of rows you can populate with data and insert together. You can see the value is 2 by default.

If you want to ignore the data you entered, click on ignore check box.

Create-Database-07

Click on browse icon for adding more records.

If you want to add or delete item click on respective icons.

And repeat the whole procedure, start from Insert tab, to insert more tabs.

Back Up of Database  

Back up of the database can be created with the help of Export tab.

Create-Database-08

Firstly, select the tables you want to export.

SQL Option will do the Radio Button selection. The structure and data checkbox will remain checked. Save the file check box and click on Go Button.

In this way, you can save the dump SQL file through the content and your database structure of your PC.

Placing large amount of database, may lead the server timeout value to be reached by; in that case you can export the database in several small batches. For more details, kindly visit MY SQL knowledge base.

Restoring a Database Back Up

Click on Import option, for restoring the database back up.

Create-Database-09

Click on browse option for selecting database back up file from your PC, and pick the file from drop down menu.

My SQL timeout can be reached, if the file selected is of large volume. In that case, you can interrupt importing of files. You can proceed with importing of data’s by defining no. of queries to skip from the file at the beginning. In such a way, you can skip imported queries and continue without interruption.

In addition to this, you can also pick the SQL compatible mode of imported file. And for more details you can go through server My SQL documentation. We provide linux web hosting india

Leave a Reply