Run read-only MySQL queries

DevOpsPad sends every MySQL query inside a transaction opened as READ ONLY, then rolls it back when the result has been read. MySQL rejects data-changing statements such as INSERT, UPDATE and DELETE inside that transaction, so an accidental write from the editor fails on the server instead of changing rows.

The read-only transaction is a safety net, not a permission system. MySQL ends the current transaction implicitly before most DDL statements, such as CREATE, ALTER and DROP, so the only reliable protection is a MySQL account that has no write privileges. Use both.

Run a query

  1. Select a MySQL connection in the Explorer and choose a database from the selector.
  2. Click a table, or click New query for an empty tab.
  3. Type a statement and press ⌘ / Ctrl + Enter or click Run query.

A MySQL query tab with the Read-only session badge, a SELECT on the orders table and 12 result rows, with Up to 500 rows and Read-only in the footer.

The tab toolbar shows Read-only session. Results appear below the editor, with up to 500 rows per query and 50 rows per result page.

SELECT status, COUNT(*) AS orders
FROM orders
WHERE created_at >= NOW() - INTERVAL 1 DAY
GROUP BY status
ORDER BY orders DESC;

What works

  • SELECT queries, including joins, subqueries and aggregates.
  • SHOW statements such as SHOW DATABASES, SHOW TABLES, SHOW PROCESSLIST and SHOW CREATE TABLE.
  • EXPLAIN for a SELECT.

What fails

  • INSERT, UPDATE, DELETE and REPLACE: MySQL returns an error because the transaction is read-only.
  • More than one statement in a single run.
  • Anything your MySQL account is not allowed to do.

DDL is the exception described above. DevOpsPad does not parse or block DDL itself, so a user with DROP privileges could still drop a table. Create a dedicated account instead:

CREATE USER 'devopspad_ro'@'%' IDENTIFIED BY '<password>';
GRANT SELECT, SHOW VIEW ON app.* TO 'devopspad_ro'@'%';

Least-privilege accounts covers this for every engine.

Results and precision

DevOpsPad keeps values exact on their way to the result grid. Large integers such as 9007199254740993 are passed as text, so they do not lose digits the way JavaScript numbers would. Dates are shown in RFC 3339 format in UTC. NULL is shown as a distinct NULL marker, not as an empty string.

Limits

  • 500 rows. If more rows exist, the footer says the result limit was reached. Add LIMIT, WHERE or aggregation.
  • 8 MiB. A preview stops when the encoded result reaches 8 MiB and says why. Select fewer or narrower columns.
  • 20 seconds. Every request has a 20-second outer timeout. Cancelling stops the client request, but the server may keep running the statement until its own timeout. See run and cancel queries.

The full list is in result limits.

Frequently asked questions

Can DevOpsPad change data in MySQL?

Not through the query editor. Each statement runs inside a read-only transaction that the server rolls back, so INSERT, UPDATE and DELETE are rejected by MySQL itself.

Can I run several statements at once?

No. Run one statement per execution. Split scripts into separate runs.