安装gerrit过程中的两个问题的处理办法

安装gerrit过程中的两个问题的处理办法:

1:报如下错误:

$ java -jar gerrit.war init -d /Library/Gerrit/

*** Gerrit Code Review 2.1.6.1
***

*** Git Repositories
***

Location of Git repositories   [/Volumes/Data/src/git]:
Import existing repositories   [Y/n]?

*** SQL Database
***

Database server type           [MYSQL/?]:
Server hostname                [localhost]:
Server port                    [(MYSQL default)]:
Database name                  [reviewdb]:
Database username              [gerrit2]:
Change gerrit2's password      [y/N]?

*** User Authentication
***

Authentication method          [OPENID/?]:

*** Email Delivery
***

SMTP server hostname           [exchsrvr]:
SMTP server port               [(default)]:
SMTP encryption                [NONE/?]:
SMTP username                  [devbuilder]:
Change devbuilder's password   [y/N]?

*** Container Process
***

Run as                         [devbuilder]:
Java runtime                   [/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home]:
Upgrade /Library/Gerrit/bin/gerrit.war [Y/n]?
Copying gerrit.war to /Library/Gerrit/bin/gerrit.war

*** SSH Daemon
***

Listen on address              [*]:
Listen on port                 [29418]:

*** HTTP Daemon
***

Behind reverse proxy           [y/N]?
Use SSL (https://)             [y/N]?
Listen on address              [*]:
Listen on port                 [8081]:
Canonical URL                  [http://myserver.local:8081/]:

Exception in thread "main" com.google.gwtorm.client.OrmException: Error in mysql_nextval.sql:
CREATE FUNCTION nextval_account_id ()
  RETURNS BIGINT
  LANGUAGE SQL
  NOT DETERMINISTIC
  MODIFIES SQL DATA
BEGIN
  INSERT INTO account_id (s) VALUES (NULL);
  DELETE FROM account_id WHERE s = LAST_INSERT_ID();
  RETURN LAST_INSERT_ID();
END;

	at com.google.gerrit.server.schema.ScriptRunner.run(ScriptRunner.java:55)
	at com.google.gerrit.server.schema.SchemaCreator.create(SchemaCreator.java:103)
	at com.google.gerrit.server.schema.SchemaUpdater.update(SchemaUpdater.java:52)
	at com.google.gerrit.pgm.Init$SiteRun.upgradeSchema(Init.java:190)
	at com.google.gerrit.pgm.Init.run(Init.java:85)
	at com.google.gerrit.pgm.util.AbstractProgram.main(AbstractProgram.java:76)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at com.google.gerrit.launcher.GerritLauncher.invokeProgram(GerritLauncher.java:155)
	at com.google.gerrit.launcher.GerritLauncher.mainImpl(GerritLauncher.java:89)
	at com.google.gerrit.launcher.GerritLauncher.main(GerritLauncher.java:47)
	at Main.main(Main.java:25)
Caused by: java.sql.SQLException: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3558)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3490)
	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2109)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2642)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2571)
	at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:782)
	at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:625)
	at com.google.gerrit.server.schema.ScriptRunner.run(ScriptRunner.java:53)
	... 13 more

解决办法:

进入数据库输入如下命令:

SET GLOBAL log_bin_trust_function_creators=1;

2. 提示:Specified key was too long
建立索引时,数据库计算key的长度是累加所有Index用到的字段的char长度后再按下面比例乘起来不能超过限定的key长度1000: 
latin1 = 1 byte = 1 character 
uft8 = 3 byte = 1 character 
gbk = 2 byte = 1 character

修改表的字符类型为latin1就可以了

发表评论

电子邮件地址不会被公开。 必填项已用*标注