Documentation menu

Docs Connections: MySQL

Set up MySQL

Verbiqo needs one account that reads performance_schema and sys, and nothing that writes. MySQL 8.0 and later, Percona Server, Amazon RDS and Aurora are supported.

MySQL 5.7 is not supported. Verbiqo still connects, and every answer says first that the version is older than it supports and what it cannot read there: the slowest statements, when settings were changed, settings saved for the next restart, and Group Replication members. The rest of the answer is not a full review. Recommendations use SET PERSIST, which 5.7 lacks: run them as SET GLOBAL and add the setting to my.cnf.

At a glance

Supported tasksAsk about locks, slow statements, replication, Group Replication and InnoDB Cluster, settings, security and capacity, and explain a slow statement without running it. Questions: Ask MySQL. Every check: MySQL checks.
LimitationsVerbiqo reads performance_schema, sys and the server’s status, never your rows. Plans of your statements need SELECT on their tables (Level 5), which the monitoring account does not have by default. MariaDB is not supported yet.
Supported versionsMySQL 8.0 and later, Percona Server, Amazon RDS and Aurora. MySQL 5.7 is not supported: Verbiqo connects, but every answer says first what it cannot read there.
AuthenticationA password, a local socket with auth_socket (the server trusts the operating-system user), or a client certificate for an account with REQUIRE X509. A client key may have a passphrase. Secrets are kept in the Keychain or Windows Credential Manager.
Minimum permissionsPROCESS and REPLICATION CLIENT on *.*, SELECT on performance_schema.*, and SELECT, EXECUTE and SHOW VIEW on sys.*. REFERENCES per schema is recommended. Commands: Create the monitoring account. What each level adds: Permission levels.
Connection testExtensions… › MySQL › Test Connection, or verbiqo mysql test <name>. A good test starts with Connected. and shows the product, version, role (source, replica or group member) and the TLS in use. On a version older than 8.0, it says so.
First useful questionThe orders app is hanging, what is going on? Verbiqo samples sessions, lock waits and transactions for 10 seconds. A schema change (DDL) queued behind an idle transaction is one finding, naming the session to end.
Safety controls
  • An account that can write or administer is refused when Verbiqo connects, including through a role. The RDS master user is refused.
  • The session is read-only, and each statement runs in START TRANSACTION READ ONLY.
  • 15 seconds per statement, and 2 seconds to wait for a lock.
  • Each statement is planned first. It is refused if it reads outside the monitoring schemas or would read too many rows.
  • EXPLAIN ANALYZE, SELECT … INTO and locking reads are refused. Verbiqo never reads mysql.user.
  • Every statement is on the access record.
Operational limitsAt most 500 rows per read. The model may add up to 6 statements per question, after Verbiqo’s own checks. Your organization can set tighter limits: Limits you can add.

1. Create the monitoring account

As an administrator, on the source or primary. Replace 10.% with the addresses Verbiqo connects from, and shop with each application schema.

CREATE USER 'verbiqo_monitor'@'10.%' IDENTIFIED BY 'choose-a-password' WITH MAX_USER_CONNECTIONS 5;

-- Level 2, required: monitoring
GRANT PROCESS, REPLICATION CLIENT ON *.* TO 'verbiqo_monitor'@'10.%';
GRANT SELECT ON performance_schema.* TO 'verbiqo_monitor'@'10.%';
GRANT SELECT, EXECUTE, SHOW VIEW ON sys.* TO 'verbiqo_monitor'@'10.%';

-- Level 3, recommended: sizes, keys and indexes (no rows)
GRANT REFERENCES ON shop.* TO 'verbiqo_monitor'@'10.%';

-- Level 4, InnoDB Cluster only
GRANT SELECT ON mysql_innodb_cluster_metadata.* TO 'verbiqo_monitor'@'10.%';

To require TLS for the account, add REQUIRE SSL. For a certificate login, REQUIRE X509.

2. Add the connection

  1. Open the form

    Extensions… › MySQL.

  2. Fill it in

    Name, host, port (3306), user verbiqo_monitor, password. Schema is optional.

  3. Choose TLS

    With a CA-signed certificate, Verify identity and its CA. MySQL’s own certificate is self-signed: Required encrypts without checking it. Keep Preferred for a lab, because it falls back to no encryption when the server offers none.

  4. Test, then save

    The test shows the product, version, role (source, replica, group member) and TLS in use.

verbiqo mysql add orders-primary --host db1 --port 3306 --user verbiqo_monitor --password-stdin --ssl-mode REQUIRED
verbiqo mysql test orders-primary
Sign-inGive
Password on standard input--password-stdin (piped in. The form above)
Password in a variable--password-env VAR, for scripts and CI
Local socket--socket /var/run/mysqld/mysqld.sock instead of host and port, for an agent on the database’s own node. With no --user, Verbiqo signs in as the operating-system user, as auth_socket expects.
Client key with a passphrase--ssl-key-passphrase-env VAR or --ssl-key-passphrase-stdin (one value at a time arrives on stdin, so pair it with --password-env)

Every verb takes --json. One statement, under the same read-only rules as a question:

verbiqo mysql query orders-primary "SELECT * FROM performance_schema.replication_connection_status"

For a replica set or cluster, save a connection to each server. Verbiqo finds the others from whichever one you attach. Through MySQL Router, each connection may land on a different member: connect to members directly.

TLS and certificates

Your serverChoose
Default auto-generated certificateRequired, or Verify CA with the server’s ca.pem from its data directory.
Certificate from your CAVerify identity, with the CA certificate.
Account with REQUIRE X509Add the client certificate and key, and the key’s passphrase if it has one (the form’s passphrase field, --ssl-key-passphrase-env VAR or --ssl-key-passphrase-stdin. Kept in the Keychain or Credential Manager, never sent anywhere).

Verbiqo checks the host name itself in Verify identity, IP addresses included. Details: Encrypted connections.

Permission levels

Checked against MySQL 8.0 and 8.4 with an account holding exactly these grants.

LevelAddsVerbiqo can answer
1. Connect onlyNo grantsThe version and little elseNot enough
2. MonitoringPROCESS, REPLICATION CLIENT, performance_schema, sysSessions, locks and blockers, transactions, statements, indexes, replication, Group Replication, settings, security, what happenedRequired
3. Schema visibilityREFERENCES per schemaTable and index sizes, auto-increment limits, missing primary keys, index suggestions with real columnsRecommended
4. InnoDB ClusterSELECT on the cluster metadataMembers missing from the metadata, Router versionsClusters
5. Query plansSELECT on the application schemasPlans of statements you paste, including the search behind a slow UPDATE or DELETE. Verbiqo only plans them: every other statement stays limited to the monitoring schemas, so no row is readOptional, if your policy allows

Refused: any privilege that writes or administers (ALL, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, SUPER, RELOAD, FILE, GRANT OPTION, dynamic *_ADMIN privileges), including through a role. The RDS master user is refused. Create a separate account. Verbiqo never reads mysql.user.

Settings that help

Ask what should I enable? to see each item as ready or not.

ItemLets Verbiqo see
A monitoring account with PROCESS, REPLICATION CLIENT and reads on performance_schema and sysSessions, locks, replication, statements.
performance_schema onAlmost every diagnosis (on by default).
Statement history consumers onWhat each session ran recently.
Table metadata visible to the accountSizes, keys and indexes (Level 3).
InnoDB Cluster metadata readableThe cluster’s own view (Level 4).
Query plans: SELECT on the application schemasPlans of statements you paste, and slow writes (Level 5).
Slow query log to a filePast slow statements, through Splunk.
Binary logs kept for point-in-time recoveryRecovery between backups. The events behind a replication error. The server keeps no record of the backups themselves.
Every deadlock written to the error logEach deadlock, not only the latest.
UPDATE performance_schema.setup_consumers SET ENABLED = 'YES'
 WHERE NAME IN ('statements_digest', 'events_statements_history');
SET PERSIST slow_query_log = ON;
SET PERSIST long_query_time = 1;
SET PERSIST log_output = 'FILE';
SET PERSIST innodb_print_all_deadlocks = ON;
SET PERSIST binlog_expire_logs_seconds = 604800;   -- a week of binary logs; log_bin itself is set in my.cnf

Query plans, only if your policy allows the account to read the tables (Verbiqo still only plans):

GRANT SELECT ON `your_schema`.* TO 'verbiqo_monitor'@'%';

Put the consumer setting in my.cnf too, so it survives a restart. On RDS and Aurora, set these in the parameter group and turn performance_schema on there (reboot).

Logs in Splunk

  • Send both logs, the error log and the slow query log, each with its host. Any sourcetype name works.
  • One slow-log entry per Splunk event. Verbiqo names the sourcetype fix when entries are split.
  • Messages in English. What it finds: Log findings.

Next: Ask MySQL.

Common errors

The connection test and the answer say what went wrong. Find the message below, then follow the fix.

Message or symptomLikely causeWhat to doNeeds an administrator?
… can change or administer the server (…), so Verbiqo will not use it.The account holds a privilege that writes or administers, directly or through a role. The message names it.Create a separate monitoring account with only the read grants (step 1).Yes, to create the account.
The server refused the account or password.The user name or password is wrong, or the account does not match the address this computer connects from.Type the password again and press Test Connection. Check the host part of the account, such as '10.%'.Only if the account or password must change.
Nothing is listening on <host>:<port>. or <host> does not resolve.The host name or port is wrong, or the server is down.Check the host and port (3306 by default) in the connection.Only if the server is down.
… accepted the connection and closed it during the handshake. If this is a MySQL Router port …The connection goes through MySQL Router, which has no member to send it to.Connect to a cluster member directly. Check the Router’s log and version.Yes, if the Router needs fixing.
The server accepts only encrypted connections: use TLS mode require or stricter.The account has REQUIRE SSL, or the server requires secure transport, and the connection does not use TLS.Choose TLS Required or stricter. More: Certificate and TLS errors.No.
MySQL 5.7… is older than Verbiqo supports (8.0 and later).The server runs MySQL 5.7. Verbiqo cannot read the slowest statements, setting history or Group Replication members there.Read the rest as a partial review. Run SET PERSIST advice as SET GLOBAL and add it to my.cnf. Upgrading to 8.0 gives full answers.Yes, to upgrade.
This account cannot plan statements over application tables.A plan needs SELECT on the statement’s tables, which the monitoring account lacks.If your policy allows, grant SELECT on that schema (Level 5). Verbiqo still only plans. It reads no rows.Yes.
performance_schema is off, so statement statistics, waits and lock details cannot be seen (it needs a restart to turn on).performance_schema, MySQL’s built-in record of activity, is turned off.Turn it on and restart. On RDS and Aurora, set it in the parameter group and reboot (Settings that help).Yes.

Something missing or unclear? Email hello@verbiqo.app.