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

Run SQL Queries in phpMyAdmin

This guide shows you how to type and run SQL commands inside phpMyAdmin to read or change your website's database.

How-To Guides2 min read7 steps4 screenshots

What is phpMyAdmin?

A database stores your website's information, such as posts, users and orders. SQL is the language you use to talk to a database. A query is one request written in SQL. phpMyAdmin is a web tool that lets you work with a MySQL database by clicking, without any command line. Most hosting control panels include it. Ask Hostvento support if you cannot find it.

Warning: Some queries delete or change data for good. Take a backup before you run them. Use the Export tab to save a copy.

Steps

  1. Log in to your hosting control panel. Your welcome email has the login details.
  2. Open phpMyAdmin.
    cPanel myadmin
  3. In the left list, click the name of your database.
  4. Click the SQL tab at the top.
  5. Type your query in the big box. Try this safe one first.
    SELECT * FROM wp_users LIMIT 5;
    This shows the first five rows of a table named wp_users. Your table name may be different. Look at the left list to find it.
  6. Click Go.
  7. Read the results in the table below the box.

Common queries

GoalQuery
Show rowsSELECT * FROM tablename;
Count rowsSELECT COUNT(*) FROM tablename;
Change a valueUPDATE tablename SET column='new' WHERE id=1;
Add a rowINSERT INTO tablename (column) VALUES ('value');
Delete a rowDELETE FROM tablename WHERE id=1;

Stay safe

  • Always put WHERE in an UPDATE or DELETE. Without it, the query changes every row.
    SQL screen
  • Test with SELECT first. Use the same WHERE to see which rows you will touch.
  • End each query with a semicolon.
    SQL query execute
    SQL query results
  • If you see a red error, read the message. It often points to a typo.

You can run more than one query at once. Put a semicolon after each one.

Quick recap

  • phpMyAdmin is a web tool for databases.
  • Choose your database, open the SQL tab, type a query, click Go.
  • Back up first, and always use WHERE when you update or delete.