Неизвестный столбец MySQL «sha256_hash» в списке полей при установке mysql в hawkBit
Я хочу настроить базу данных MySQL с сервером обновлений hawkBit. Чтобы включить MySQL, я сделал следующие шаги:
sudo mysql -u root
*Welcome to the MariaDB monitor. Commands end with ; or \g.*
*Your MariaDB connection id is 31*
*Server version: 10.1.47-MariaDB-0ubuntu0.18.04.1 Ubuntu 18.04*
*Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.*
*Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.*
MariaDB [(none)]> USE mysql;
*Reading table information for completion of table and column names*
*You can turn off this feature to get a quicker startup with -A*
*Database changed*
MariaDB [mysql]> CREATE USER 'test'@'localhost' IDENTIFIED BY '123456a@';
*Query OK, 0 rows affected (0.00 sec)*
*MariaDB [mysql]> UPDATE user SET authentication_string=password('123456a@') where user='test';*
*Query OK, 0 rows affected (0.00 sec)*
*Rows matched: 1 Changed: 0 Warnings: 0*
MariaDB [mysql]> GRANT ALL PRIVILEGES ON *.* TO 'test'@'localhost';
*Query OK, 0 rows affected (0.00 sec)*
MariaDB [mysql]> UPDATE user SET plugin='mysql_native_password' WHERE User='test';
*Query OK, 1 row affected (0.01 sec)*
*Rows matched: 1 Changed: 1 Warnings: 0*
MariaDB [mysql]> FLUSH PRIVILEGES;
*Query OK, 0 rows affected (0.00 sec)*
MariaDB [mysql]> CREATE DATABASE hawkbit;
*Query OK, 1 row affected (0.00 sec)*
MariaDB [mysql]> ALTER DATABASE hawkbit COLLATE latin1_bin;
Query OK, 1 row affected (0.00 sec)
MariaDB [mysql]> grant all privileges on hawkbit.* TO 'test'@'localhost' identified by '123456a@';
*Query OK, 0 rows affected (0.01 sec)*
MariaDB [(none)]> exit
*Bye*
sudo service mysql restart
Добавьте следующий код в hawkbit-runtime / hawkbit-update-server / pom.xml
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<scope>compile</scope>
</dependency>
Замените следующий код на hawkbit-runtime / hawkbit-update-server / src / main / resources / application-mysql.properties:
spring.jpa.database=mysql
spring.datasource.url=jdbc:mysql://localhost:3306/hawkbit
spring.datasource.username=test
spring.datasource.password=123456a@
spring.datasource.driverClassName=org.mariadb.jdbc.Driver
Восстановите и запустите:
cd hawkbit
mvn clean install
java -jar ./hawkbit-runtime/hawkbit-update-server/target/hawkbit-update-server-0.3.0-SNAPSHOT.jar --spring.profiles.active=mysql
После успешного запуска hawkBit с включенным MySQL я вижу много ошибок, связанных с MySQL. Например:
Unknown column 'sha256_hash' in 'field list'
Я думаю, что база данных несовместима с сервером обновлений hawkbit, поскольку в ней нет таблицы. Так что я с нетерпением жду опыта от всех, кто преуспел в настройке MySQL с помощью hawkbit, а также точных команд для создания таблицы базы данных.
Спасибо