REQUIRE is a security-focused clause that appears inside GRANT and CREATE USER statements in MySQL and MariaDB. It lets administrators mandate that any session established by the account use an encrypted connection (SSL) and, optionally, present an X.509 certificate with matching attributes such as SUBJECT, ISSUER, or CIPHER. If the client fails to meet the declared requirement, the server rejects the connection during the TLS handshake. REQUIRE is evaluated at connection time only and does not retroactively affect already-established sessions. Because REQUIRE is non-standard, it is unavailable in PostgreSQL, SQL Server, Oracle, or SQLite. Instead, those systems rely on server-level SSL enforcement or parameter-based authentication.
SSL
(keyword) - Connection must be encrypted with TLS but no certificate attributes are checked.X509
(keyword) - Connection must use TLS with a valid client certificate signed by any trusted CA.SUBJECT 'pattern'
(string) - Permitted X.509 Subject Distinguished Name (supports wildcards).ISSUER 'pattern'
(string) - Permitted X.509 Issuer Distinguished Name (supports wildcards).CIPHER 'cipher_name'
(string) - Exact name of the allowed TLS cipher.NONE
(keyword) - Removes previously set REQUIRE options for the account.GRANT, CREATE USER, SSL, X509, ALTER USER, MySQL authentication plugins
MySQL 4.0.3
The server terminates the TLS handshake and returns ERROR 1045 (28000): Access denied for user because the certificate attributes do not satisfy the REQUIRE constraints.
Yes. For example, REQUIRE SUBJECT 'subj' ISSUER 'issuer' forces the client to present a cert whose subject and issuer both match. If any option fails, the connection is rejected.
There is minimal overhead beyond the standard TLS handshake, which is typically negligible compared to query execution time.
Query the mysql.user table columns ssl_type, x509_issuer, x509_subject, and ssl_cipher or use SHOW CREATE USER 'user'@'host';