Enable LDAD authentication
To use LDAP authentication, you need to add the LDAP service into the FE node configuration first.uid=${USER},ou=People,dc=example,dc=com
If you have users across multiple OUs, you can specify multiple patterns separated by semicolons:
uid=${USER},ou=Engineering,dc=example,dc=com;uid=${USER},ou=Marketing,dc=example,dc=com
The system will try each pattern in order and return the first successful bind.
Note
The pattern must produce a valid LDAP Distinguished Name (DN). UPN-style patterns like ${USER}@corp.example.com are not supported, because the result is not a DN and would break downstream group lookups. If your DN contains @ in an attribute value (e.g., uid=${USER}@corp.example.com,ou=People,dc=example,dc=com), that is valid.
DN Matching Mechanism
Starting from v3.5.0, the database supports recording and passing user Distinguished Name (DN) information during LDAP authentication to provide more accurate group resolution.How it Works
-
Authentication Phase: LDAPAuthProvider records both pieces of information after successful user authentication:
- Login username (for traditional group matching)
- User’s complete DN (for DN-based group matching)
-
Group Resolution Phase: LDAPGroupProvider determines the matching strategy based on the
ldap_user_search_attrparameter configuration:- When
ldap_user_search_attris configured, it uses username as the key for group matching. - When
ldap_user_search_attris not configured, it uses DN as the key for group matching.
- When
Use Cases
- Traditional LDAP Environment: Group members use simple usernames (such as
cnattribute). Administrators need to configureldap_user_search_attr. - Microsoft AD Environment: Group members may lack username attributes.
ldap_user_search_attrcannot be configured. The system will use DN directly for matching. - Mixed Environment: Flexible switching between both matching methods is supported.
Authentication priority
When a user logs in with LDAP authentication, the database determines the user’s DN using the following priority:- Per-user DN: If the user was created with an explicit DN (
CREATE USER ... AS 'dn'), that DN is used directly. - Direct bind via DN pattern: If
authentication_ldap_simple_bind_dn_patternis configured, the system constructs the DN from the pattern and attempts to bind directly. Multiple patterns are tried in order. - Search-and-bind: If neither of the above applies, the system uses the admin account to search for the user in LDAP, then binds with the found DN.
Resolve groups from the user entry (memberOf)
From v4.2 onwards, the groups of an LDAP user can be read from the group membership attribute of the user’s own entry, instead of declaring in the configuration which groups to look at. A group newly created in the directory then takes effect on the next login without any configuration change. Two FE configuration items control it, both dynamic:group_provider(default) keeps the behavior of earlier versions: only the group providers are used.memberofuses only the attribute of the user’s own entry. Configured group providers are ignored, but their configuration is kept.bothreturns the union of the two.
memberOf fits Active Directory and OpenLDAP with the memberof overlay installed. Oracle Directory Server and 389 Directory Server use isMemberOf.
These are cluster-wide defaults. A security integration can override both with properties of the same name, which is the recommended way to configure them per LDAP service — see Security Integration for the full behavior, including how the attribute is read in each authentication mode and what is not covered (nested groups, the Active Directory primary group, and cross-domain groups).
Note
A user created with an explicit DN (CREATE USER ... IDENTIFIED WITH authentication_ldap_simple AS '<dn>') does not support this feature: that form is the legacy per-user mechanism and is scheduled for deprecation, so its group resolution is unchanged. Create the user without AS '<dn>', or use a security integration.
Case sensitivity
There is no single answer for the whole LDAP configuration - some values are compared by the FE and some by the directory - so the table below says which is which.Create a user with LDAP
When creating a user, specify the authentication method as LDAP authentication byIDENTIFIED WITH authentication_ldap_simple AS 'xxx'. xxx is the DN (Distinguished Name) of the user in LDAP.
Example 1: Create a user with an explicit DN.
authentication_ldap_simple_bind_base_dn: The base DN of the user, specifying the retrieval range of the user.authentication_ldap_simple_user_search_attr: The name of the attribute in the LDAP object that identifies the user, uid by default.authentication_ldap_simple_bind_root_dn: The DN of the administrator account used to retrieve the user information.authentication_ldap_simple_bind_root_pwd: The password of the administrator account used when retrieving the user information.
authentication_ldap_simple_bind_dn_pattern instead. This does not require an admin account.
Authenticate users
LDAP authentication requires the client to pass on a clear-text password to the database. There are three ways to pass on a clear-text password:Connect from MySQL client with LDAP
Add--default-auth mysql_clear_password --enable-cleartext-plugin when executing:
Connect from JDBC/ODBC client with LDAP
- JDBC
- ODBC
default\_auth=mysql_clear_password and ENABLE_CLEARTEXT\_PLUGIN=1 in the DSN of ODBC: , along with username and password.
Connect over HTTP or Arrow Flight with LDAP
A clear-text password is what the HTTP API and Arrow Flight SQL send anyway, so an LDAP-bound user needs nothing special there: HTTP Basic authentication and the Arrow Flight user name and password both end in the same LDAP bind. This works for a user created withIDENTIFIED WITH authentication_ldap_simple and for a user of an LDAP security integration alike. See Where each authentication method works.