HostMonster Web Hosting Help

How to run SQL queries in phpMyAdmin

This tutorial demonstrates how to run SQL queries in phpMyAdmin.

SQL queries are commands that you issue to the MySQL server to tell it to perform various functions. Designed for advanced users, this allows you to quickly make changes to your database simply by issuing the appropriate commands.

This tutorial shows you where to execute SQL queries, but not what queries to execute. The exact SQL queries you will execute will depend on what you want to do.

Be careful when executing SQL queries, because it will do whatever you tell it to do (and not necessarily what you want it to do). Always double check any destructive commands (such as DROP) to make sure it is acting upon the items you intend it to act upon. If you are making significant changes, it is recommended that you make a backup before you begin.

Queries are Context Sensitive

The SQL tab appears above all pages inside of phpMyAdmin.  This tab is context sensitive, which means that depending on what you're looking at, the target of your SQL queries might be different.

If you are on the home page of phpMyAdmin and do not have any databases selected, if you click the SQL tab, any queries you run will apply to the overall server (or hosting account if on shared hosting).

If you select a database, any queries run by clicking on the SQL tab will apply to that database.

If you select a table within a database, any queries run by clicking on the SQL tab will apply to that table.

Summary of Steps

Begin by accessing phpMyAdmin via cPanel.

  1. Navigate to the area your SQL query will apply to.
    • The phpMyAdmin home page if you want the query to apply to the entire server or hosting account.
    • The database you want to run queries against.
    • The table you want to run queries against.
  2. Click the SQL tab.
  3. Type in your SQL query.
  4. Click the Go to execute the query.

Your SQL query will be executed and the actions you requested will be performed.

Knowledgebase Article 16,606 views bookmark tags: databases mysql phpmyadmin (updated 862 days ago)


Was this resource helpful?

Did this resolve your issue?


Please add any other comments or suggestions about this content:





Recommended Help Content

Optimizing MySQL: Queries and Indexes Article 4 of 4 Courtesy of:Ian Gilfillan Most systems need to be highly optimized for selects - take a news site which performs millions of queries per day, but w (updated 1366 days ago)
Knowledgebase Article 69,819 views tags: cpu exceeded index indexes mysql optimize optimizing queries query

Optimizing MySQL: Queries and Indexes Article 1 of 4 Courtesy of: Ian Gilfillan Badly defined or non-existent indexes are one of the primary reasons for poor performance, understanding and then fixing (updated 975 days ago)
Knowledgebase Article 95,021 views tags: indexes mysql optimize optimizing queries query

Optimizing MySQL: Queries and Indexes Article 2 of 4 Courtesy of: Ian Gilfillan Some knowledge of how indexes work allows you to use them more efficiently. Firstly, note that when you update a table w (updated 1365 days ago)
Knowledgebase Article 83,696 views tags: indexes mysql optimize optimizing queries query

Related Help Content

A step by step guide on how to manipulate data in your mySQL tables using phpMyAdmin (updated 861 days ago)
Knowledgebase Article 41,239 views tags: databases mysql phpmyadmin

Optimizing MySQL: Queries and Indexes Article 3 of 4 Courtesy of: Ian Gilfillan Ordering by surname is a common requirement, so it would make sense to create an index on surname. But in this example o (updated 1367 days ago)
Knowledgebase Article 76,009 views tags: cpu exceeded index indexes mysql optimize optimizing queries query

A guide to duplicating a MySQL database using phpMyAdmin (updated 862 days ago)
Knowledgebase Article 29,618 views tags: databases mysql phpmyadmin

A repository of information on how you can manage your database by using the phpMyAdmin interface. (updated 861 days ago)
Knowledgebase Article 146,548 views tags: commands database mysql phpmyadmin

A tutorial on how to perminately delete columns from your mySQL database using phpMyAdmin (updated 860 days ago)
Knowledgebase Article 36,393 views tags: Plesk cpanel databases mysql phpmyadmin

Step by step directions on how you can search your database using phpMyAdmin (updated 861 days ago)
Knowledgebase Article 12,345 views tags: Plesk cpanel databases mysql phpmyadmin

Instructions on changing the name of your database using phpMyAdmin (updated 862 days ago)
Knowledgebase Article 34,725 views tags: cpanel databases mysql phpmyadmin

A guide on renaming the tables inside of your database using phpMyAdmin (updated 45 days ago)
Knowledgebase Article 14,044 views tags: databases mysql phpmyadmin