Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Run Queries on a MySQL Database in phpMyAdmin

This guide shows how to open phpMyAdmin and run SQL queries to look at, add and change data.

Databases2 min read7 steps

What is phpMyAdmin?

A database is a place where your website keeps its information in tables. phpMyAdmin is a web page that lets you work with a MySQL database by clicking, without a command line.

A query is a written instruction you send to the database. The language is called SQL. For example, you can ask, "Show me all customers from Delhi."

Open phpMyAdmin

  1. Log in to cPanel. Your login link is in your Hostvento welcome email.
  2. In the Databases section, click phpMyAdmin.
  3. In the left list, click the name of your database.

Run a query

  1. Click the SQL tab at the top.
  2. Type your query in the big box.
  3. Click Go.
  4. The results show below.

Useful queries

Show the first 10 rows of a table:

SELECT * FROM customers LIMIT 10;

The star means "all columns". LIMIT 10 stops after ten rows.

Find rows that match a rule:

SELECT name, email FROM customers WHERE city = 'Delhi';

This shows only the name and email of customers in Delhi.

Count rows:

SELECT COUNT(*) FROM customers;

Add a row:

INSERT INTO customers (name, city) VALUES ('Asha', 'Pune');

Change a row:

UPDATE customers SET city = 'Mumbai' WHERE name = 'Asha';

Delete a row:

DELETE FROM customers WHERE name = 'Asha';
Warning: UPDATE and DELETE without a WHERE part change or remove every row. Always include WHERE, and export a backup first using the Export tab.

Use the Search tab

If you do not want to write SQL, click a table and then the Search tab. Fill in the boxes and click Go. phpMyAdmin builds the query for you.

Fix errors

  • Check that quotes are closed and every query ends with a semicolon.
  • Check table and column names for typos.
  • Read the red message. It names the spot where the error starts.

Quick recap

  • Open phpMyAdmin from cPanel and pick your database.
  • Use the SQL tab, type a query and click Go.
  • SELECT reads, INSERT adds, UPDATE changes, DELETE removes.
  • Always use WHERE with changes and deletes.
  • Back up with Export before big changes.