在配置好sonar的sonar.properties和sonar-scanner.properties的jdbc配置后
sonar.jdbc.url=jdbc:mysql://192.168.168.12:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false
sonar.jdbc.username=root
sonar.jdbc.password=root
sonar.sorceEncoding=UTF-8
sonar.login=admin
sonar.password=admin
sonar.jdbc.url=jdbc:mysql://192.168.168.12:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false
sonar.jdbc.username=root
sonar.jdbc.password=root
发现无法连接其他服务器上的mysql数据库,而使用localhost连接本地数据库,就可以。
后来反复查帖子看到这句话,无论你安装的什么版本,一定一定首先要看官方文档,知道要首先创建空数据库并创建用户
CREATE DATABASE sonar CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER 'sonar' IDENTIFIED BY 'sonar';
GRANT ALL ON sonar.* TO 'sonar'@'%' IDENTIFIED BY 'sonar';
GRANT ALL ON sonar.* TO 'sonar'@'localhost' IDENTIFIED BY 'sonar';
FLUSH PRIVILEGES;
附上SonarQube7.6配置和使用-windows配置
参考资料