声纳设置MYSQL

时间:2015-07-28 17:22:15

标签: mysql sonarqube

我正在尝试将默认数据库更改为MYSQL。我使用了一些教程 http://laurenthinoul.com/how-to-change-sonar-default-database/。 Mysql数据库创建并运行。

我的问题是文件夹..sonarqube \ sonarqube-5.1.1 \ conf默认文件sonar.properties所有配置都被评论我试过取消注释mysql驱动程序,但它不起作用。我的问题为什么默认数据库被评论,以及如何更改为Mysql。

# DATABASE
#
# IMPORTANT: the embedded H2 database is used by default. It is recommended for tests but not for
# production use. Supported databases are MySQL, Oracle, PostgreSQL and Microsoft SQLServer.

# User credentials.
# Permissions to create tables, indices and triggers must be granted to JDBC user.
# The schema must be created first.
#sonar.jdbc.username=sonar
#sonar.jdbc.password=sonar

#----- Embedded Database (default)
# It does not accept connections from remote hosts, so the
# server and the analyzers must be executed on the same host.
#sonar.jdbc.url=jdbc:h2:tcp://localhost:9092/sonar

# H2 embedded database server listening port, defaults to 9092
#sonar.embeddedDatabase.port=9092


#----- MySQL 5.x
# Only InnoDB storage engine is supported (not myISAM).
# Only the bundled driver is supported.
#sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance

然后我尝试访问localhost:9000 / setup我收到错误

迁移失败:发生错误,所有后续迁移都被取消:ActiveRecord :: JDBCError:表'rule_tags'已存在:CREATE TABLE rule_tagsid int(11)auto_increment PRIMARY KEY,{ {1}} varchar(100))ENGINE = InnoDB CHARACTER SET utf8 COLLATE utf8_bin。 请检查日志。

LOG:

tag

1 个答案:

答案 0 :(得分:1)

即使没有定义sonar.jdbc.url设置,SonarQube也会从默认数据库H2开始。 取消注释MySQL配置(#sonar.jdbc.url = jdbc:mysql ...)并更新网址是件好事。

我可以确认您的Sonarqube服务器正在使用MySQL,因为我可以在日志中看到ENGINE = InnoDB,这是MySQL特有的。

由于错误表示该表已经存在,也许您已经尝试开始使用此架构,但它未能结束然后您重试? 如果是这样,我建议您从新模式重新启动。

为了能够为您提供更多帮助,请发送整个日志。