Working with phpmyadmin tool
Working with PhpMyAdmin in XAMPP
What is PhpMyAdmin in PHP
PhpMyAdmin is a GUI(Graphical User Interface) tool for MySQL Database. This is bundled with Xampp, no need to install separately.
Why we Use it
- Database management.
- Tables structure management
How to Open PhpMyAdmin
- First open XMPP control panel
- Start Apache server next
- Start the MySQL server and click on the admin button of MySQL server. Or you can open with the link:http://localhost/phpmyadmin/
Creating Databases
Click on Databases Tab
In create database box, enter the name of the database and click create button
Creating Table
- Click on Database "usersdb".
- In the bottom in create table box, enter table name and number of columns and click on Go.
- In the next window provide all the field names, field datatype, field size and click on Save.
Specifying Field names, Data Types and sizes
For table register field details are as given below
id INT(11)
username VARCHAR(50)
password VARCHAR(15)
mobile VARCHAR(10)
email VARCHAR(50)
Field Modifiers or Constrains
Null : if set Not null the filed can be blank.
Default : default value can be provided.
Unique : selecting one or two fields can be unique key.
Autoincrement: column value incremented automatically.
Adding Keys
In structure tab, select the field and click primary key.[ ]
Selecting the Most Appropriate Data Type for the field
Type MaxSize
char 256
varchar 65, 535.
tinytext 256 bytes
tinyint 128 to 127.
smallint signed: -32768 to 32767
Altering Table Structure
By selecting structure tab, you can modify table properties such as
- Adding new field or
- Deleting existing field in the table
- Altering Field Properties such as Datatype, size, not null, collation..etc. You can do it by clicking the change link of specific field.
Adding new Field
Select table,
Select structure tab
Then you will see the below image. In the bottom panel, select the number of columns you want to add and select after which column from the dropdown, and click the go button. Next, One new form is opened to enter field details such as name, type, size etc. enter the details and click on Save button.
Backing Up and Restoring Databases and Tables
From PhpMyAdmin, we can move data from one system to another using- import
- export
Open database, select export tab, select type of exporting file(SQL., CSV, XML…etc.)
click Go
Importing:Restoring Databases and Tables from Backup
select import tab, click 'Browse' and select the file you want to import into the
current database.
And click Go
Demo
Dropping Databases and Tables
Click databases tab, select the database from the databases list, and click drop button
[ ] from the bottom of the window.
Dropping Tables
Select the database table. It shows a list of tables, select the table and click drop button from same row.
Comments
Post a Comment