Open the SQL tab
Pick the scope
Click a database in the left tree to run queries against the whole database. Click into a specific table to scope queries to that table.
Type or paste your query
Multiple statements separated by semicolons all run in sequence. The result panel shows them stacked.
Useful keyboard shortcuts
| Keys | Action |
|---|---|
Ctrl+Enter | Run the query (same as clicking Go) |
Ctrl+Space | Auto-complete table or column names |
Tab | Indent (handy when nesting queries) |
Bookmarks
If a query is one you’ll run repeatedly, save it as a bookmark.
Bookmarks are per database. Useful patterns:
- A long
JOINyou tweak when debugging - A
DELETE FROM sessions WHERE last_seen < NOW() - INTERVAL 30 DAYyou run before exports - An ad-hoc analytics query for the marketing team
Query history
The SQL tab keeps a running list of queries you’ve executed in the current session. Open the Query history dropdown above the editor to revisit them. Sessions reset when you close the browser tab, so save anything important as a bookmark.Safety tips for production data
A few habits that have saved me:- Run as
SELECTfirst. RunSELECT * FROM users WHERE last_login < '2024-01-01'before turning it intoDELETE FROM users WHERE last_login < '2024-01-01'. Confirm the row count matches what you expected. - Wrap in a transaction for InnoDB tables.
START TRANSACTION;before theUPDATE/DELETE, thenSELECT COUNT(*)to verify, thenCOMMIT;(orROLLBACK;if it’s wrong). Doesn’t work on MyISAM. LIMITyour destructive queries.DELETE FROM logs WHERE created_at < '2024-01-01' LIMIT 1000, run it a few times. Easier to spot a wrong condition before you’ve nuked half the table.- Take an export first. Five minutes of “I’ll just dump it before I touch it” can save hours of restore work later.
Common issues
#1064 You have an error in your SQL syntax
#1064 You have an error in your SQL syntax
A typo, an unclosed quote, or a backtick around something that doesn’t need one. Look at the position pointed at in the error message. phpMyAdmin highlights the offending character.If the query was pasted from somewhere else, check for smart-quote characters that look like
' but aren’t.#1142 SELECT command denied to user
#1142 SELECT command denied to user
The user you’re running phpMyAdmin as doesn’t have read access to that table. cPanel logs you in as the cPanel account user, which has access to your databases. But if you’ve revoked privileges through Manage My Databases, this is the message you’ll see.
The query runs forever and the page hangs
The query runs forever and the page hangs
A
JOIN on un-indexed columns, or a LIKE '%...' against a big text column. Either kill the query (close the browser tab and the connection drops within a minute) or add an index first via Table Operations.Repeated long-running queries from the same account can trigger our automatic resource limits. See common issues on Manage My Databases.


