Skip to content

Connect MySQL

This page is for Portward in Claude on the web. It covers a MySQL 8 database that the internet can reach, such as one on Amazon RDS. Connect a source has the steps of the form. This page has what is particular to MySQL.

For the Portward gateway in your own cloud, see MySQL on the gateway (Enterprise) instead.

  • The host name, the port (3306 unless yours differs) and the database name, from your provider’s connection details.
  • A login that can only read, with its password. Make one with the script below.
  • The database reachable from the internet. See If your database is behind a firewall.

Give Portward its own login. Don’t reuse your application’s login or your own.

The setup form writes this script for you. Open Need a login that can only read? under the fields: it names the login and the database you typed. This is the script for a database named shop. Replace the password placeholder, then run it as an administrator:

CREATE USER 'portward_ro'@'%' IDENTIFIED BY '<replace with a new password>';
GRANT SELECT ON `shop`.* TO 'portward_ro'@'%';

If the database’s name has an underscore or a percent sign in it, the form writes it with a backslash in front (shop\_prod). In a grant on a whole database MySQL reads those two characters as wildcards, and the backslash keeps the grant to that one database.

To keep a column out of the login’s reach as well, grant columns instead of the whole database, table by table:

GRANT SELECT (id, region, total) ON shop.orders TO 'portward_ro'@'%';

Then the database itself keeps the other columns back, whatever happens above it.

Portward never runs the script and keeps none of it. The Matching login SQL that Personal shows, written from your levels column by column, is for other kinds of database.

The check reads the login’s grants. It refuses a login that holds, on every database:

  • ALL PRIVILEGES, SUPER, FILE, SHUTDOWN, RELOAD, CREATE USER or SYSTEM_USER,
  • any privilege whose name ends in _ADMIN,
  • or the right to grant its privileges to others.

So the admin login a managed database gives you at sign-up is refused. Make the login above.

A login that can insert, update, delete, create, drop or alter in this database passes with a warning. Every query still runs in a read-only transaction that is rolled back.

  • Portward connects from the internet, with no fixed address. A private address is refused.
  • The connection is always encrypted. Portward checks the server’s certificate and that it matches the host name you typed. A server that offers no encrypted connection is refused.
  • Certificates from the public authorities are accepted. Amazon RDS signs its own, and Portward accepts those for RDS host names only.
  • The login must be allowed to connect from outside. 'portward_ro'@'%' in the script allows any address.
  • The tables and views of the one database you name, with their columns.
  • At setup, Portward reads the names of tables and columns and the login’s grants. In the form in the chat, it also reads the first 5 rows of a table to show you sample values. See Keep from Claude.

Portward’s rules mean the same thing for every kind of source. For MySQL, each one names this:

RuleWhat it names in MySQL
What Claude can readA table or view the login can read. See What Portward reads.
Kept from ClaudeA column.
Row ruleThe rows that match a condition on a column, such as region = 'EU'.
Totals onlySums, averages and counts of a column. A group of fewer than 5 rows is merged.
ReceiptThe columns sent and the columns kept from Claude, and how many rows Claude got.

The login is the floor. Portward reads with the one login you give it, and what you choose in Portward only narrows from there. Kept columns work on every plan. Levels, with totals only and row rules, work on Free’s one connection and on Team. On Team, which isn’t open yet, an admin can also give one teammate less than everyone gets. See On Team.

  • Each query is one SELECT, in a read-only transaction.
  • A query is stopped after 30 seconds.
  • On Free, a result reads at most 200 rows. See Plans and limits.

Troubleshooting lists each message with its cause and fix.