Open the SQL tab
1
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.
2
Click the SQL tab at the top
A multi-line text area opens with a basic syntax-highlighted editor.



3
Type or paste your query
Multiple statements separated by semicolons all run in sequence. The result panel shows them stacked.
4
Click Go
The results appear under the editor. Above the results, phpMyAdmin echoes the SQL it ran. Useful for spot-checking before you re-run.
Useful keyboard shortcuts
Bookmarks
If a query is one you’ll run repeatedly, save it as a bookmark.1
Type the query
Same as a normal run.
2
Tick 'Bookmark this SQL query'
Below the editor, just above Go.
3
Name and save
Give the bookmark a name. Click Go.
4
Run it later
On any future visit to the SQL tab, scroll down to Bookmarked SQL query and pick it from the dropdown. Click Submit to run it again.
- 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.Need a hand?
Open a ticket
Best for anything that needs an account check or a config change on our end.
Live chat
Faster for quick questions during business hours.

