我正在使用Sonarqube和MySql。我有Jenkins,我想将Sonar runner与TC集成,主要用于不同的项目(Java,PHP)。我做了以下事情:
MySQL的:
CREATE DATABASE sonar CHARACTER SET UTF8;
CREATE USER 'sonar'@'*' IDENTIFIED BY 'sonar';
GRANT ALL ON sonar.* TO 'sonar'@'*';
FLUSH PRIVILEGES;
sudo systemctl stop firewalld
StartSonar.bat
启动声纳时,出现以下错误:堆栈跟踪:
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'sonar'@'10.1.162.61' (using password: YES))
at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549) ~[commons-dbcp-1.4.jar:1.4]
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388) ~[commons-dbcp-1.4.jar:1.4]
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044) ~[commons-dbcp-1.4.jar:1.4]
at org.sonar.core.persistence.DefaultDatabase.checkConnection(DefaultDatabase.java:115) ~[sonar-core-5.1.2.jar:na]
... 28 common frames omitted
Caused by: java.sql.SQLException: Access denied for user 'sonar'@'10.1.162.61' (using password: YES)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:996) ~[mysql-connector-java-5.1.34.jar:5.1.34]
我在这里想念的是什么?
答案 0 :(得分:0)
解决方案是在conf文件夹中的sonar.properties中启用声纳凭证,如下所示:
# User credentials.
sonar.jdbc.username=sonar
sonar.jdbc.password=sonar
#----- MySQL 5.x
# Only InnoDB storage engine is supported (not myISAM).
# Only the bundled driver is supported.
sonar.jdbc.url=jdbc:mysql://10.1.163.103:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance