WARN BasicResourcePool - Acquisition Attempt Failed!!!
Last acquisition attempt exception:
java.sql.SQLException: Access denied for user 'ykf_test_cx'@'%' to database 'oms_test'
用戶 ykf_test_cx 無權訪問數據庫 oms_test。 具體表現為:
'%' 表示任意主機,但可能被具體 IP 規則覆蓋)SELECT User, Host FROM mysql.user WHERE User = 'ykf_test_cx';
SHOW GRANTS FOR 'ykf_test_cx'@'%';
-- 若無 oms_test 權限,執行授權:
GRANT ALL PRIVILEGES ON `oms_test`.* TO 'ykf_test_cx'@'%';
FLUSH PRIVILEGES;
'ykf_test_cx'@'192.168.1.100''%' 不匹配 localhost(Unix socket),本地連接需額外授權 'ykf_test_cx'@'localhost'日誌顯示使用 c3p0 連接池(BasicResourcePool),確認配置文件中:
jdbcUrl 包含正確數據庫名:jdbc:mysql://host:3306/oms_testuser / password 無拼寫錯誤acquireRetryAttempts 默認 30,日誌顯示已達上限,說明重試無意義,必須修復權限mysql_ssl_rsa_setup 啟用 SSL 連接,生產環境禁用明文傳輸。NumBusyConnections、NumFailedAcquires 異常時告警。權限問題看似簡單,卻是生產事故高發區 —— 授權前三思,變更後驗證。