Symptom
The Access denied error is returned for a connection trial or test.
The following error message is returned:
The database reported a permission error. Please check the connection configuration and make sure that the password is correct and you have access permission to the default database. The current default database is `test`. Error details: Could not connect to address=(host=some.domain.com)(port=2881)(type=master) : (conn=3221531229) Access denied for user 'root'@'xxx.xxx.xxx.xxx' (using password: YES)
Possible causes
The password of the database account is incorrect.
The account does not have the permissions to access the database.
The IP address of the server where ODC resides is not added to the allowlist of the tenant.
The Oracle mode is selected for a MySQL tenant.
Solutions
Connect to the database by using an OBClient
If you can use Navicat and OBClient V1.x to successfully connect to the database but the ODC connection fails, the IP address of the server where ODC resides is not added to the allowlist of the tenant. In this case, add the IP address of the server where ODC is located to the allowlist of the tenant.
Check whether the allowlist of the tenant contains the IP address of the server where ODC resides:
SHOW VARIABLES LIKE 'ob_tcp_invited_nodes';
The system variable
ob_tcp_invited_nodesspecifies the IP address allowlist of the tenant, which is a global parameter for the tenant. Default value:***.*.*.*,::1. The default value indicates that only the local server is allowed to connect to the tenant.%indicates that all client IP addresses are allowed to connect to the tenant. Hyphens (_) and IP addresses (separated by commas) are supported. IP address list match, mask match, and fuzzy match are supported.
Failed to connect to the database by using OBClient
Check whether the account and password of the database are correctly entered.
Use OBClient to check whether the database account has the privileges to access the corresponding database.
-- View the database privileges granted to the current user in a MySQL tenant show grants; -- View the roles granted to the current user in an Oracle tenant select * from USER_ROLE_PRIVS; -- View the database privileges granted to the current user in an Oracle tenant select PRIVILEGE from ROLE_SYS_PRIVS where ROLE='ROLE_NAME';