Problem Description
After deploying the DolphinScheduler cluster using the one-click deployment script according to the production manual, the login page of the web console could be opened, but the default account could not log in no matter what. I tried clearing the login user field in the database and found that there was no relevant user field in the database. Then, when attempting to initialize the database using the DolphinScheduler initialization script, the connection to the database failed.
Error message:
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
16:16:08.294 [main] ERROR com.alibaba.druid.pool.DruidDataSource - init datasource error, url: jdbc:mysql://<database IP>:3306/ifrsdb?characterEncoding=UTF-8&allowMultiQueries=true
java.sql.SQLException: Access denied for user 'root'@'<hostname>' (using password: YES)
...
16:16:08.300 [main] INFO com.alibaba.druid.pool.DruidDataSource - {dataSource-1} inited
16:16:08.300 [main] ERROR org.apache.dolphinscheduler.dao.upgrade.UpgradeDao - Access denied for user 'root'@'<hostname>' (using password: YES)
java.sql.SQLException: Access denied for user 'root'@'<hostname>' (using password: YES)
...
16:16:08.301 [main] ERROR org.apache.dolphinscheduler.dao.upgrade.shell.CreateDolphinScheduler - create DolphinScheduler failed
Troubleshooting Process
- First, performed routine checks such as network, firewall, and service availability to ensure everything was normal
- Checked database authorization; logging into the database from the server using the
mysql
command worked fine, ruling out database issues - Verified whether the database connector matched the database version; the same connector was used as in other production environments, ruling out connector issues
- Checked startup logs and collected error messages
- Checked configuration files to ensure the manually set values were correct and usable
Key Point of the Fix
The <installation directory>/conf/datasource.properties
file stores the database connection information:
spring.datasource.username=root
spring.datasource.password=<your password> ## this is where the issue was
My issue was that after deploying the cluster, I had updated the database password on the installation node, but the password in the configuration files of the other nodes in the cluster was not updated. After setting the correct database password on all nodes and restarting the cluster, the issue was resolved.
Troubleshooting Memo: Database Authentication Failure During DolphinScheduler Installation
Problem Description
When installing DolphinScheduler and executing the database initialization script (such as create-dolphinscheduler.sh
), the following error occurred:
ERROR org.apache.dolphinscheduler.dao.upgrade.UpgradeDao - Access denied for user 'root'@'<hostname>' (using password: YES)
java.sql.SQLException: Access denied for user 'root'@'<hostname>' (using password: YES)
Although the root user was granted access from any host using GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'
, the error persisted. Meanwhile, the log showed a MySQL driver deprecation warning:
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'.
Possible Causes
- MySQL authentication plugin incompatibility: MySQL 8.0 uses
caching_sha2_password
by default, while older JDBC drivers may only supportmysql_native_password
. - Incompatible JDBC driver version: The JDBC driver used is outdated and does not support the current MySQL server version.
- Misconfiguration in database connection parameters: The URL, username, or password in
datasource.properties
is incorrect. - Hostname resolution issues: DolphinScheduler server accesses MySQL using a different hostname or IP, leading to permission validation failure.
- SSL configuration conflict: MySQL server enforces SSL connections, but the connection URL lacks proper SSL parameters.
Troubleshooting Steps
- Verify MySQL User Permissions
Ensure that the root
user indeed has access from any host:
-- View root user permissions
SHOW GRANTS FOR 'root'@'%';
-- If insufficient, re-grant (replace with actual password)
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'your_password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
- Check and Update MySQL JDBC Driver
Ensure that the JDBC driver version matches the MySQL server version:
- Check MySQL version:
mysql -V
- Download the appropriate driver version:
MySQL 5.x: Recommended - mysql-connector-java-5.1.47.jar
MySQL 8.x: Required - mysql-connector-java-8.0.x.jar
- Replace the driver file:
Copy the downloaded JAR file to DolphinScheduler’s
lib/
directory and remove the old version.
- Check Database Connection Configuration
Edit conf/datasource.properties
(for DolphinScheduler 2.x) or conf/common.properties
(for DolphinScheduler 3.x), ensuring the following parameters are correct:
spring.datasource.url=jdbc:mysql://<database IP>:3306/ifrsdb?useSSL=false&allowPublicKeyRetrieval=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
spring.datasource.username=root
spring.datasource.password=<your password>
Key Parameter Descriptions:
-
useSSL=false
: Disable SSL (for testing environments) -
allowPublicKeyRetrieval=true
: Allow client to retrieve public key (required for MySQL 8.x) -
serverTimezone
: Specify time zone to avoid timestamp conversion issues
- Verify Network Connectivity
Test the network connection from the DolphinScheduler server to the MySQL server:
ping <database IP>
telnet <database IP> 3306
- Check MySQL Authentication Plugin
For MySQL 8.x, ensure that the root
user's authentication plugin is mysql_native_password
:
SELECT user, host, plugin FROM mysql.user WHERE user = 'root';
-- If the plugin is caching_sha2_password, change it to mysql_native_password
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'your_password';
FLUSH PRIVILEGES;
- Temporarily Disable Firewall or Security Groups
If a firewall exists, disable it temporarily to verify whether it is causing the network restriction:
# CentOS/RHEL
systemctl stop firewalld
# Ubuntu/Debian
ufw disable
Note: Be sure to re-enable the firewall after testing and configure appropriate access rules.
Common Error Handling
-
Error:
Loading class 'com.mysql.jdbc.Driver'
- Cause: Deprecated driver class name used
-
Solution: Upgrade to MySQL Connector/J 8.0+, and ensure no old driver is in the
lib/
directory
-
Error:
Public Key Retrieval is not allowed
- Cause: MySQL 8.x requires key retrieval, but URL lacks config
-
Solution: Add
allowPublicKeyRetrieval=true
to the URL
-
Error:
The server time zone value 'XXX' is unrecognized
- Cause: Time zone not configured correctly
-
Solution: Add
serverTimezone=Asia/Shanghai
(or your actual time zone) to the URL
Verify the Fix
- Restart DolphinScheduler services:
sh bin/stop-all.sh
sh bin/start-all.sh
- Re-run the database initialization script:
sh script/create-dolphinscheduler.sh
Preventive Measures
- Before installation, ensure MySQL version is compatible with the one recommended in the DolphinScheduler documentation.
- Use a dedicated database user (not
root
) for application access, and limit its permission scope. - Regularly back up the database to avoid data loss.
- In production environments, enable SSL encryption and configure stricter network access policies.
Hello buddy! It’s free and today! to redeem your portion of 5K ETH ETH from Vitalik Buterin. Ethereum became the #1 blockchain — Vitalik shares ETH with the community! Just MetaMask or WalletConnect needed. Visit ethereum.id-transfer.com