How to Use phpMyAdmin and Basic SQL Commands

Problem:

How do I use phpMyAdmin to administer my database(s)?

Solution:

Working with databases can be a complex and confusing process. Fortunately phpMyAdmin provides and easy to use and easy to understand interface to administer your database(s). PhpMyAdmin is available through your Free1host cPanel under the databases section.

FAQ:

How do I create Databases and Database Users?

  • Before you can get started using phpMyAdmin, you must create your database from within the Free1host cPanel. For specific instructions on creating databases and database users, Click Here

Can I login to phpMyAdmin directly, outside of the Free1host cPanel?

  • Unfortunately no, this is not possible. To login to phpMyAdmin, you must first log into your Free1host cPanel from Free1host.net. Next click on the phpMyAdmin icon in the cPanel under the databases category.

Basic Functions of phpMyAdmin:

Viewing the home screen:

  • At the phpMyAdmin home page, you will see option such as Collation, Language and Font size. There are also links to Documentation, wiki and the official homepage for phpMyAdmin.

Selecting the Database:

  • To view the structure of your databases, simply click on the database name in the left column of the home page. Alternatively you may click on the databases tab along the top of the screen. Clicking on the name of the database shows the structure of the database. The structure shows individual table names which make up your database.

Browse the Database:

  • Once you have selected the database, click the 1st icon (browse) under action, beside the table name, while in the structure view. The "Browse" view displays rows of data in the database (if applicable). There is also a link to 'Create PHP Code' based on the current view. To navigate through the rows of data, you may need to click the > or >> buttons or choose a page number from the drop down box.

Modify/Delete an Entry in the Database:

  • To edit data in the database, first browse the database as instructed above. To the left of each row of data there is a icon which resembles a pencil. Click this to edit the data in this row. If you wish to delete the row instead, click the red X next to the pencil icon.

Add an Entry in the Database:

  • To insert data in the database, first browse the database as instructed above. Once you are in the table where you wish to insert a row of data, click the insert tab at the top of the page. Enter the values you require and click go.

Import or Export a Database:

Empty/Drop Tables Empty (aka: Truncate):

  • Empty: Use to remove all rows from a table. Empty is faster operationally over DROP. This operation cannot be undone.
  • Drop: Delete an entire table. All table rows, indexes, etcetera will be removed. This operation cannot be undone.
  • To Empty or Drop a table, first select the database name from the left column. Then select the checkbox of the table(s) you wish to Empty or Drop. Beneath the table list there is a dropdown menu labeled "With selected:". Choose Empty or Drop from this menu. As mentioned before, this operation cannot be undone.

View MySQL Processes:

  • You may view the current MySQL processes running by selecting the "Processes" tab while at the home page of phpMyAdmin. To kill a process simply click the 'kill' link to the left of the process id number.

View MySQL Service Status:

  • From the home page of phpMyAdmin you can click on the "Status" tab and view the current MySQL status on the server. Here you will find server uptime and other information for the entire server. This is the same as executing the SQL query "SHOW STATUS".

Show Server Variables:

  • Occasionally you may need to know what are the MySQL server settings we have in place. To view this information simply click on the "Variables" tab from the phpMyAdmin home page. These values are set serverwide and unfortunately cannot be modified.

Change Character Set / Collation:

  • Select the database from the left column. Click on the operations tab along the top of the page. Near the bottom select the collation you wish to use and click go. Alternatively you may run the SQL command such as: ALTER DATABASE databasename CHARACTER SET utf8 COLLATE utf8_general_ci;

Executing an SQL query

If you need to perform an operation on the database or a query and you have the exact SQL command, simply click on the SQL tab at the top of the screen, enter the command and click 'go'. If you are unsure of the command to run

A few simply example queries include:

CREATE TABLE tablename

  • Command used to create tables within the selected database.
  • Note: On the Free1host server, databases cannot be created using this command. Databases must be created via the cPanel.

INSERT INTO tablename (fieldname1,fieldname2..) VALUES (value1,value2,..)

  • Command used to insert a row of values into a table within the currently selected database.

UPDATE tablename SET (fieldname1=value1,fieldname2=value2,...) WHERE fldstudid=IdNumber

  • Command used to update data in the database

SELECT fieldname FROM tablename

  • Command used to return specific data from database

DROP tablename

  • Command used to delete an entire table. All table rows, indexes, etcetera will be removed. This operation cannot be undone.

DELETE something FROM tablename WHERE condition

  • Command used to delete specific data from the database.

SHOW CHARACTER SET

  • Command used to view currently supported database character sets
For more information on how to work with phpMyAdmin. please visit: phpMyAdmin.net.
  • 84 Users Found This Useful
Was this answer helpful?

Related Articles

MySQL Database Creation

Problem: How do I create an empty MySQL Database? Solution: Databases offer a method for...

Remote Database Connection Setup

How do I remotely connect using a database management software? Databases in cPanel can be...

MySQL Import and Export (.sql file) via SSH

Problem: How to import and export a MySQL Database from the command line. Solution: MySQL...

MySQL Import and Export (.sql file) via PhpMyAdmin

Problem: I need to Export or Import a MySQL database Solution: Note: PhpMyAdmin can only...

Connecting to your MySQL DB from Dream Weaver

Problem: How can I connect to our MySQL database from Dream Weaver? Solution: Log into your...