$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 35
Server version: 5.7.20-0ubuntu0.16.04.1 (Ubuntu)
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> SELECT USER();
+----------------+
| USER() |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)
mysql> create database reviewdb;
Query OK, 1 row affected (0.01 sec)
mysql> CREATE USER 'gerrit'@'localhost' IDENTIFIED BY 'gerrit';
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> grant all privileges on reviewdb.* to gerrit@localhost identified by
'gerrit';
Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| reviewdb |
| sys |
+--------------------+
8 rows in set (0.01 sec)
mysql>
Gerrit 安装过程中,可能会报出如下的 Exception:
Exception in thread "main" com.google.gwtorm.server.
OrmException: Cannot apply SQL
CREATE TABLE account_group_members_audit (
added_by INT DEFAULT 0 NOT NULL,
removed_by INT,
removed_on TIMESTAMP NULL DEFAULT NULL,
account_id INT DEFAULT 0 NOT NULL,
group_id INT DEFAULT 0 NOT NULL,
added_on TIMESTAMP NOT NULL
,PRIMARY KEY(account_id,group_id,added_on)
)
at com.google.gwtorm.jdbc.JdbcExecutor.execute
(JdbcExecutor.java:44)
at com.google.gwtorm.jdbc.JdbcSchema.createRelations
(JdbcSchema.java:134)
at com.google.gwtorm.jdbc.JdbcSchema.updateSchema
(JdbcSchema.java:104)
at com.google.gerrit.server.schema.SchemaCreator.create
(SchemaCreator.java:81)