Automate certificate renewal on PostgreSQL and MySQL

Database server certificates now renew far more often under the CA/Browser Forum schedule. This page covers how PostgreSQL and MySQL pick up new certificate files and how to automate the renewal and reload.

On this page

How can PostgreSQL and MySQL certificate renewal be automated, and what do shorter lifetimes change?

Database administrators running PostgreSQL or MySQL can renew server certificates without a restart, because both servers read their certificate and key files at startup and can reload them from configuration afterward. The shorter public certificate schedule matters here: the CA/Browser Forum Baseline Requirements cap subscriber certificate validity at 200 days from 15 March 2026, at 100 days from 15 March 2027, and at 47 days from 15 March 2029. Renewals that once arrived about once a year will arrive several times a year, and each one needs a reload step that someone has to remember or automate. The database itself does not request certificates from a certificate authority. The automation sits in whatever obtains the new file, whether that is an ACME client, an internal certificate authority tool or a secrets platform, and then triggers the reload. The database administrators own the reload and the server configuration, while the platform team that owns certificate issuance owns the job that writes the new file. Both teams need to agree on who runs the reload, where the file lands and how a failed renewal is noticed.

On PostgreSQL, the server reads ssl_cert_file and ssl_key_file (defaulting to server.crt and server.key in the data directory) at start and on reload, and a reload is triggered with pg_reload_conf() or pg_ctl reload. A reload that finds a bad file keeps the old configuration and writes an error to the server log, so the renewal can fail quietly. Check the result with the pg_file_settings view after each reload, and keep the key file permissions tight, since the server rejects a key that is readable by group or world. A passphrase-protected key can block reload-based changes unless ssl_passphrase_command_supports_reload is in use, so confirm that setting against the version you run before choosing a key format.

On MySQL 8.4, the files are named by ssl_cert, ssl_key and ssl_ca in the [mysqld] section, and replacing those files is not enough on its own. Run ALTER INSTANCE RELOAD TLS (which needs the CONNECTION_ADMIN privilege) to rebuild the TLS context for new connections, and then confirm that new connections present the new certificate. Existing connections keep the old certificate until they end, so plan a way to end them with KILL if the old certificate must stop being used. Decide between the default rollback behavior and NO ROLLBACK ON ERROR before the first automated run, because the second option disables encryption for new connections on that interface when the reload fails. Confirm each detail against the documentation for your exact MySQL version before you rely on it.

What the 200-day, 100-day and 47-day schedule means for database servers

This table sets out the three steps of the schedule for publicly trusted subscriber certificates, with the maximum validity and the validation reuse period for each. Read each row as the renewal load a database host will carry from that date, and the point at which a manual process stops being workable. The main takeaway is that renewal frequency roughly doubles and then grows about fivefold from the first step to the last, so the reload procedure needs to be scripted before the 100-day step arrives.

Effective dateMaximum certificate validityValidation reuse period and what it means on a database host
From 15 March 2026200 daysReuse of domain and IP validation up to 200 days. Roughly 2 renewals per year. Manual renewal is still possible but needs a calendar reminder and a tested reload.
From 15 March 2027100 daysReuse of domain and IP validation up to 100 days. Roughly 4 renewals per year. Manual renewal becomes error-prone, so scheduled renewal and a reload hook should be in place.
From 15 March 202947 daysReuse of domain and IP validation up to 10 days. Roughly 8 renewals per year. Manual steps stop working, and renewal, file replacement and reload must run unattended.
Applies toPublicly trusted subscriber certificatesCertificates issued by a public certificate authority under the CA/Browser Forum Baseline Requirements. Confirm which of your database certificates are public.
Internal certificatesSet by the internal CA policyPrivate certificates issued by your own internal certificate authority follow that CA's policy, not this schedule. Check the lifetime your internal CA sets.
PostgreSQL reloadReload with pg_reload_conf() or pg_ctl reloadPostgreSQL reads the certificate files at start and on reload. A failed reload keeps the old configuration and logs the error, so confirm the reload succeeded.
MySQL reloadALTER INSTANCE RELOAD TLSNew connections use the reloaded context. Existing sessions keep the old certificate until they end, so plan for the KILL statement on older sessions if needed.
Renewal count assumptionIllustrative onlyRenewal counts are rounded estimates from the validity periods, not a measured figure. Confirm your own renewal intervals with your CA and renewal client.
What to confirmYour CA's current behaviourConfirm with your certificate authority and in the PostgreSQL and MySQL documentation how each step applies to the versions you run.

How PostgreSQL and MySQL load a new certificate file

Renewal on either database depends on when the server reads its certificate and key files, because a new file on disk does not change a running server by itself. PostgreSQL expects server.crt and server.key in the server's data directory by default, and other paths can be set with the parameters ssl_cert_file and ssl_key_file. The server reads these files at start and again whenever its configuration is reloaded. The reload is triggered by a SIGHUP, which is most easily sent with pg_ctl reload or the SQL function pg_reload_conf(). A reload that finds an error in the certificate or key does not stop the server. It ignores the new files, keeps the old SSL configuration, and writes the error to the server log. The same error at start would stop the server from starting, so a renewal script should check the log after each reload instead of assuming it worked. On Unix, server.key must not be accessible to the world or the group, for example chmod 0600 server.key, or the server will reject it.

MySQL 8.4 takes a different route. The server certificate, private key and CA are set with the system variables ssl_cert, ssl_key and ssl_ca, each pointing to a file in PEM format, for example in the [mysqld] section of my.cnf. Changing these variables at runtime does not affect the TLS context used for new connections. The change takes effect only after the statement ALTER INSTANCE RELOAD TLS runs, which requires the CONNECTION_ADMIN privilege. By default, if the new context cannot be built, the statement rolls back with an error and the previous values keep serving new connections. The NO ROLLBACK ON ERROR option changes that behavior: it produces a warning and disables encryption for new connections on that interface, so teams should avoid it in automated renewals unless they have tested the fallback. Existing connections are not changed by a reload and stay on the old context until they end, and the KILL statement can end them if needed. Confirm the exact behavior for the MySQL version in use against the ALTER INSTANCE documentation.

Which automation options PostgreSQL and MySQL support

PostgreSQL reads the server certificate and private key at server start and again whenever its configuration is reloaded, so a renewed certificate can be picked up without a restart. The files default to server.crt and server.key in the data directory, and other locations can be set with ssl_cert_file and ssl_key_file. The reload is triggered by a SIGHUP to the main server process, which is most easily sent with pg_ctl reload or the SQL function pg_reload_conf(). The reload needs the ability to run one of these commands on the host or as a database role allowed to call the function.

  • Signal and command: Send SIGHUP through pg_ctl reload on the host, or call pg_reload_conf() from a session.
  • File location: The files live in the data directory by default, or at the paths set by ssl_cert_file and ssl_key_file.
  • File permissions: On Unix, server.key must not be accessible to the world or group, for example chmod 0600 server.key, or it must be owned by root with group read access (0640).
  • Limits: A reload with an error in the certificate or key files keeps the old SSL configuration and reports the error in the server log, while an error at start stops the server. A passphrase-protected key by default disables changing SSL settings without a restart.
  • Existing sessions: Existing sessions adopt the new values after they finish their current client command. Check the pg_file_settings view to confirm a reload took effect.

Confirm the exact privilege needed for pg_reload_conf() on your version in the PostgreSQL documentation.

How to set up renewal and reload on each database

This sequence sets each database to read its certificate and key from fixed paths that renewal writes to, then reloads the running server so new connections use the renewed certificate while existing sessions stay up. Follow the PostgreSQL or MySQL steps for the engine you run, and confirm each step before moving to the next.

  1. Point the server at the renewal file paths

    Set the certificate and key locations in the server configuration so the server reads from the paths your renewal automation writes to. In PostgreSQL, set ssl_cert_file and ssl_key_file in postgresql.conf, or accept the defaults server.crt and server.key in the data directory. In MySQL 8.4, set ssl_cert, ssl_key and ssl_ca in the [mysqld] section of my.cnf, each pointing to a PEM file. Confirm the paths by checking that the files exist at those locations and that the automation has write access to them. Done when the configuration names the same paths your automation uses.

  2. Set restrictive permissions on the private key

    On Unix, the PostgreSQL server rejects a key file whose permissions are more liberal than allowed, so restrict access before the first reload. Either set the file to owner-only access with chmod 0600, or make root the owner and give the group read access with mode 0640. The PostgreSQL documentation describes both options. Apply the same care to the MySQL key file, since the renewal process needs to write it and the database process needs to read it. Confirm by listing the file permissions and checking that no world access is granted. Done when the key file has the mode you chose and the database account can still read it.

  3. Place the renewed certificate and key

    Have your renewal automation write the new certificate and private key to the configured paths, replacing the previous files. Write the key and certificate in a way that avoids leaving a partial pair in place, for example by writing to temporary files and moving them into position. Keep the certificate chain complete so clients can validate the server. Confirm by checking the certificate's expiry date and subject against what you expect from the issuer. Done when the files at the configured paths contain the new certificate and matching key.

  4. Reload the PostgreSQL configuration

    Trigger a configuration reload so PostgreSQL rereads the certificate and key files without a restart. Run pg_ctl reload against the data directory, or call the SQL function pg_reload_conf() from a session with sufficient privilege. The main server process propagates the reload to running sessions, which adopt the new values after their current command completes. If the reload hits an error in the files, PostgreSQL keeps the old SSL configuration and writes the error to the server log. Done when the reload returns successfully and the server log shows no SSL error.

  5. Reload the MySQL TLS context

    Run ALTER INSTANCE RELOAD TLS to rebuild the active TLS context from the current ssl_* variable values. The statement requires the CONNECTION_ADMIN privilege and reloads the main connection interface by default. By default, if the new context cannot be created, the statement rolls back with an error and the previous values continue for new connections. Existing connections are not affected by the reload, so use KILL on specific connections only when you need them to adopt the new certificate. Done when the statement completes without error.

  6. Check the certificate that new connections receive

    Open a new connection from a client and confirm that the server presents the renewed certificate, by checking its serial number, expiry date and issuer. For PostgreSQL, the pg_file_settings view shows whether a reload took effect and reports any value that was rejected. For MySQL, confirm the TLS state from a new session and check the server error log for reload warnings. Done when a fresh connection shows the new certificate and the logs contain no reload errors.

  7. Record the check and schedule the next renewal

    Note the certificate's new expiry date, the time of the reload and the result of the check in your renewal log, so the next cycle can be compared against it. Confirm that the renewal automation will repeat the sequence before the new certificate expires, and check that the reload step remains part of it. Verify the schedule against your issuer's documented lifetime, since the lifetime of public certificates is changing under the CA/Browser Forum rules. Done when the log entry exists and the next run is scheduled.

What has to be in place before automating database certificate renewal

Renewing a database certificate without dropping connections depends on a few conditions being true before the automation runs. Each card below covers one condition, from file permissions and reload privileges to passphrase handling, source reachability and access to the configuration.

File permissions on server key

PostgreSQL checks the permissions on server.key at startup and reload, and it rejects the file if those permissions are more liberal than allowed. On Unix, no access may be granted to world or group, for example with chmod 0600 server.key, or the file can be owned by root with group read access (0640). Before automating, confirm that the account running the renewal job can write the new key and certificate, and that the database server's account can still read the key after the swap. Check this on a staging host first, because a wrong mode means the server ignores the new key on reload.

PostgreSQL SSL docs

CONNECTION_ADMIN privilege for MySQL

On MySQL 8.4, the statement ALTER INSTANCE RELOAD TLS requires the CONNECTION_ADMIN privilege. The renewal job's database account must hold this privilege, or the reload step fails after the new files are already in place. Grant it to a dedicated account used only for reloads, and test the reload with that account in a non-production instance. Note which account the automation uses so that credential rotation and audit logs can be traced back to it.

MySQL 8.4 ALTER INSTANCE

Passphrase-protected keys block reload

PostgreSQL states that a passphrase-protected private key disables the ability to change the server's SSL configuration without a restart by default. Check whether the current key is encrypted with a passphrase before planning a reload-based renewal. If it is, look up the parameter ssl_passphrase_command_supports_reload in the PostgreSQL configuration documentation and confirm how your version handles it. If the key must stay encrypted, plan a restart window in addition to the reload path.

PostgreSQL SSL docs

Reachable certificate source

The automation has to fetch or receive the renewed certificate from a source the database host can reach at the time of renewal. That source may be an internal certificate authority, an ACME client's output directory, or a secrets store, depending on how your certificates are issued. Confirm the network path, credentials and failure behavior before the first scheduled run. If the source is unreachable, decide whether the job should keep the current certificate in place and raise an alert, so the database never ends up with a half-written file.

Access to data directory or my.cnf

On PostgreSQL, the default certificate and key names are server.crt and server.key in the server's data directory, and other locations can be set with ssl_cert_file and ssl_key_file. On MySQL, the files are named in the [mysqld] section of my.cnf with ssl_cert, ssl_key and ssl_ca. The renewal job needs write access to the directory or file it replaces and read access to the configuration that points to it. Record the exact paths on each host, because a job that writes to the wrong location reports success while the server keeps using the old certificate.

MySQL encrypted connections

How to confirm database renewals keep happening

Renewal is not finished when the new file lands on disk. The first check is to read the certificate the database actually serves: compare the expiry date of the certificate returned on the TLS connection with the expiry date of the file you replaced, for example by connecting with a client that prints the server certificate. If the served certificate still shows the old expiry date, the reload did not take effect, and the database has kept its previous SSL configuration. Run this check after every renewal and on a schedule between renewals, because a reload can fail silently while the files look correct. Keep the expiry dates of the served certificate in the same record you keep for each renewal, so you can show when each certificate was in service.

On PostgreSQL, watch the server log after every reload. PostgreSQL re-reads server.crt and server.key, or the files named by ssl_cert_file and ssl_key_file, when the configuration is reloaded, and if it finds an error during a reload it keeps the old SSL configuration and reports the error in the log instead of stopping. Search the log for SSL and reload errors immediately after pg_ctl reload or pg_reload_conf(). If the log is quiet but the served certificate has not changed, query the pg_file_settings view to see which value the server took for each setting and which file and line it came from, and whether an error was recorded against the setting. This view shows what a reload did or did not apply. Confirm the file permissions on the key as well, since the server rejects a key that is readable by other users, and that rejection shows up as a reload error.

On MySQL 8.4, confirm the result of ALTER INSTANCE RELOAD TLS directly rather than assuming it worked. By default the statement rolls back with an error if the new context cannot be built, so an error in the client output means the previous certificate is still in use. If you used NO ROLLBACK ON ERROR, check the warnings, because encryption is disabled for new connections on that interface when the new context fails. After a successful reload, make a new connection and confirm the served certificate has the new expiry date, since existing connections keep the old context until they end. Keep a written record of every renewal for auditors and customers: the date, the database and interface, the expiry dates before and after, the result of each reload, and who performed the step. Confirm with your database vendor and internal policy which logs and retention periods your evidence needs to meet.

Questions people ask about renewing PostgreSQL and MySQL certificates

Does PostgreSQL reload SSL certificates without a restart?

Yes, PostgreSQL reads the SSL certificate and key files at server start and again whenever the server configuration is reloaded, so a reload is enough to pick up a renewed certificate without restarting the server. The usual way to trigger it is pg_ctl reload or the SQL function pg_reload_conf(), which send a SIGHUP to the main server process. If PostgreSQL finds an error in the files during a reload, it ignores them, keeps the old SSL configuration and writes the error to the server log, while an error at server start stops the server from starting. Check the log after each reload. A passphrase-protected private key by default disables changing the SSL configuration without a restart, so confirm how your key is protected before you plan the renewal. The PostgreSQL documentation describes the ssl_passphrase_command_supports_reload parameter for that case.

Does MySQL need a restart after installing a new certificate?

No restart is needed in MySQL 8.4 when you run ALTER INSTANCE RELOAD TLS. Changing the ssl_* and tls_* system variables at runtime does not affect the TLS context for new connections until that statement runs, which rebuilds the context from the current variable values. The certificate, key and CA files are named by ssl_cert, ssl_key and ssl_ca in the [mysqld] section of my.cnf. For an expired certificate, the MySQL documentation says that replacing the file contents with a nonexpired certificate and running the reload is sufficient for new connections. By default the reload rolls back with an error if the new context cannot be created, so the previous settings keep working. The NO ROLLBACK ON ERROR option behaves differently: it generates a warning and disables encryption for new connections on that interface, so do not use it on a production server without a plan for that case.

What is the CONNECTION_ADMIN privilege used for in MySQL certificate renewal?

In MySQL 8.4, the CONNECTION_ADMIN privilege is required to run ALTER INSTANCE RELOAD TLS. That is the statement that rebuilds the TLS context from the updated ssl_* variables, so the account that performs a certificate reload needs this privilege. Plan for it when you set up an automation account: a renewal job that runs under an account without the privilege will fail at the reload step. Confirm the exact grant syntax and any related privileges in the MySQL 8.4 documentation for your version, and test the job against a non-production instance before you rely on it. The statement also accepts an optional FOR CHANNEL clause, which the documentation describes as mysql_main or mysql_admin. By default it reloads the main connection interface.

Do existing database connections switch to the new certificate after a reload?

No. For both PostgreSQL and MySQL, the new certificate applies to new connections, and existing connections keep the TLS context they started with. In PostgreSQL, the main server process propagates the SIGHUP to running server processes, so existing sessions adopt the new configuration values after they finish any client command they are executing. In MySQL 8.4, the documentation states that existing connections remain unaffected by ALTER INSTANCE RELOAD TLS, and the KILL statement can end them. If your clients must move to the new certificate promptly, plan a controlled way to close or cycle existing sessions, and check which connections are still using the old certificate after the reload. Confirm the behavior for the exact versions you run in their documentation.

Does ACME work for renewing certificates on PostgreSQL and MySQL servers?

The sources for this page do not describe ACME support for PostgreSQL or MySQL, so this page does not state whether an ACME client can issue or renew certificates for these servers directly. Both servers read certificate and key files from disk, so an ACME client would need to write renewed files to the locations the server expects, followed by a reload, but whether a given client does that is not covered here. Check the documentation of your ACME client and of the database version you run before you design the job. Note also that the CA/Browser Forum's schedule reduces the maximum publicly trusted subscriber certificate validity to 200 days from 15 March 2026, 100 days from 15 March 2027 and 47 days from 15 March 2029, which makes unattended renewal more important.

Should a team get outside help to automate database certificate renewal?

It depends on how many databases you run, how they are configured and who owns the renewal process. Teams with a small number of servers, a clear reload procedure and staff who already manage certificates may handle the work in-house. Outside help is useful when the estate mixes PostgreSQL and MySQL versions, when keys are passphrase-protected, when reload failures must not reach production, or when certificate lifetimes are shortening on a schedule your team has not yet planned for. DeployOpen plans, implements and documents self-hosted open-source platforms in your own infrastructure, and can scope renewal automation as a fixed-scope engagement with deliverables and timelines agreed in writing before work starts. A quote follows from that written scope, and DeployOpen does not publish a price list.

What should a renewal test check before it goes to production?

Test the full renewal path on a non-production instance first. For PostgreSQL, check that the server accepts the new files on reload, that the key file permissions meet the server's requirements (on Unix the file must not be accessible to the world or group, for example chmod 0600 server.key, or owned by root with group read access, 0640), and that the server log shows no SSL errors. For MySQL, check that ALTER INSTANCE RELOAD TLS succeeds under the automation account, and confirm that new connections present the new certificate. In both cases, verify which existing connections still use the old certificate afterwards. Use the vendor documentation for your exact versions to confirm each step, since the sources here cover PostgreSQL and MySQL 8.4 and not every release.

How a renewed certificate reaches a running database server

The flow starts when a certificate authority issues a new certificate, and the automation client writes it to the file the database reads. On PostgreSQL, a reload signal from pg_reload_conf() or pg_ctl reload makes the main process reread server.crt and server.key, and existing sessions adopt the new values after their current command finishes. On MySQL 8.4, the reload is ALTER INSTANCE RELOAD TLS, and only new connections use the new context. Check the reload result, since a failed reload keeps the old configuration.

Renewed certificate flow from issuance to the database reloading it.

How DeployOpen helps teams automate database certificate renewal

DeployOpen works with database administrators to renew PostgreSQL and MySQL server certificates and reload them without dropping live connections. Each engagement starts with a written scope that names the database versions, certificate paths and reload method in use.

How we scope

  • We confirm which PostgreSQL or MySQL versions run in your environment and where each server reads its certificate and key files.
  • We record whether private keys are passphrase protected, since that affects whether the SSL configuration can change without a restart.
  • Engagements are fixed-scope, and the written scope lists the servers, deliverables and renewal steps covered before work starts.

How we build

  • We set up renewal so PostgreSQL picks up new files with a configuration reload, using pg_reload_conf() or pg_ctl reload.
  • For MySQL, we replace the files named by ssl_cert, ssl_key and ssl_ca, then run ALTER INSTANCE RELOAD TLS for new connections.
  • We test each reload path on a non-production server and check that the file permissions on the private key meet PostgreSQL's requirements.

How we hand over

  • You receive documentation of the renewal steps, the reload commands and the privileges each job needs, including CONNECTION_ADMIN for MySQL.
  • We document how to check the server log for reload errors, since PostgreSQL keeps old SSL settings when a reloaded file has an error.
  • We walk your database administrators through a test renewal so they can run the process themselves on the next certificate cycle.

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers for teams that want renewal checked after each change.
  • Retainers can cover re-testing when PostgreSQL or MySQL versions change, since reload behavior should be confirmed for the version you run.
  • Support can also extend to confirming renewal works ahead of shorter public certificate lifetimes, using the dates published in the CA/Browser Forum requirements.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.