# Server configuration and authentication

> Configure the listener, database, dialect, password exchange and TLS.

---

LLMS index: [llms.txt](/llms.txt)

---

## SQL object index {#objects}

Look up a function overload, operator, type or MySQL metadata relation by its installed signature. [pg_mysql 1.0 object index](/docs/mysql/reference/objects/)

## Inspect the running server {#parameters}

Use native `psql` as the administrator. These are the 14 PostgreSQL settings registered by `pg_mysql` 1.0. `boot_val` is the compiled default, `setting` the effective value in this backend. A MySQL `@@` variable belongs to a different namespace. For example, `SELECT @@max_allowed_packet` reports the packet limit, while the PostgreSQL configuration entry has the `mysql.` prefix.

```sql
SELECT name, boot_val, setting, unit, context, pending_restart
FROM pg_settings WHERE name LIKE 'mysql.%' ORDER BY name;
```

### Cluster settings requiring restart {#restart}

| Parameter | Default and accepted values | Effect |
|---|---|---|
| `mysql.listener_on` | `on`, boolean | Enables the MySQL TCP listener when the module is preloaded. Set `off` to stop accepting connections on this protocol at the next start. |
| `mysql.port` | `3306`, integer 0–65535 | `0` disables the listener. The native PostgreSQL port defaults to 5432. |
| `mysql.listen_addresses` | Unset. Comma-separated host names or IP addresses, or `*` | Unset or empty inherits PostgreSQL `listen_addresses`. An empty inherited list disables TCP. Bind a specific interface for application access. |
| `mysql.auth_cache_size` | `1024`, integer 0–1000000 entries | Shared fast-auth cache capacity in users. At `0` each password login uses full authentication. |
| `mysql.rsa_private_key_file` | `mysql_rsa_private_key.pem`, file path | RSA private key for full authentication without TLS. Relative paths start at the data directory. An OpenSSL build generates a missing key. An empty path disables RSA key loading. |
| `mysql.auto_create_extension` | `on`, boolean | On the first authenticated MySQL superuser connection, install the SQL extension if missing, before reporting login success. An ordinary user needs it installed already. Standbys and binary upgrade suppress automatic installation. |

### Cluster settings applied by reload {#reload}

Edit the active configuration and run `SELECT pg_reload_conf();` in an administrative PostgreSQL session. Reconnect to verify handshake settings and the target database.

| Parameter | Default and accepted values | When a client sees it |
|---|---|---|
| `mysql.database` | `postgres`, PostgreSQL database name | New connections bind to this database. Create it and install the extension there first. Existing connections stay in their original database. |
| `mysql.compat_version` | `5.7.32-log`, string | Reloadable `major.minor.patch` with an optional `-suffix`. The handshake, `VERSION()` and `@@version` return the full string. The numeric part determines the handshake collation and which versioned comments execute. An invalid value leaves the active version in effect on reload. |
| `mysql.default_authentication_plugin` | `caching_sha2_password` or `mysql_clear_password`, default the former | Advertised at the next login. The server checks the role's PostgreSQL credentials. |
| `mysql.max_allowed_packet` | `67108864`, integer 1024–1073741823 **bytes** | Limit for an incoming MySQL message or accumulated prepared-statement long data. Read the effective limit with `SELECT @@max_allowed_packet`. |
| `mysql.deadlock_timeout` | `50ms`, 0–2147483647 ms | Dynamic default for MySQL sessions. A positive value also defaults `log_lock_waits` to off. Zero inherits PostgreSQL defaults. Explicit PostgreSQL server, role, database and session settings take precedence. |

If reloading `mysql.compat_version` changes which `?` placeholders occur in an executable comment, the next execution of that prepared statement returns error `1615` (`HY000`). Prepare it again and bind the parameters for the new version. Statements with the same parameter positions can continue on the existing connection.

### Session settings {#session}

| Parameter | Default and accepted values | Scope |
|---|---|---|
| `mysql.parser` | `mysql` (default), `postgres`; `postgresql` is an alias | Selects the grammar for subsequent queries arriving over the MySQL protocol. The connection still returns MySQL packets. Native connections use the PostgreSQL parser. |
| `mysql.statement_rollback` | `on`, boolean | Inside a MySQL transaction, an ordinary statement error rolls back to a hidden savepoint. With `off` an error can abort the transaction. Deadlocks and serialization failures require a full transaction retry. |
| `mysql.default_collation` | `case_insensitive` (default), string. Also accepts `case_sensitive`, `ignore_accents`, MySQL collation names and `default` or empty for database default | Default used by subsequent MySQL DDL for character columns without an explicit column or table collation. MySQL names follow the dialect mapping. Existing columns keep their definitions. |

An application can set session options for its connection. For example, in `mysql`, switch parsers, issue PostgreSQL SQL over the same socket, then switch back.

```sql
SELECT set_config('mysql.parser', 'postgres', false);
SELECT current_database(), 42::integer;
SELECT set_config('mysql.parser', 'mysql', false);
```

## Admit a client {#authentication}

Once the listener is up, authentication depends on the target PostgreSQL database, role, TLS and HBA match. [Configure passwords, HBA and TLS](/docs/mysql/reference/authentication/)

## Where to find the schemas {#schemas}

Connect with native `psql` to the database named in `mysql.database`. Application schemas sit alongside the [extension schemas](/docs/mysql/architecture/#schemas). A connection to a different native database has its own catalogs and installed extensions.

---

Section pages:

- [Password authentication and TLS](/docs/mysql/reference/authentication/): Match HBA entries, authenticate existing PostgreSQL roles and verify TLS from a MySQL connection.
- [pg_mysql object index](/docs/mysql/reference/objects/): Object counts, SQL signatures and source definitions from one fresh installation of pg_mysql 1.0 on Mimus 19.0.1.

---

Backlinks:

- [MySQL](/docs/mysql/)
