由于 "java.sql.SQLException: Access denied for user",Java 无法写入数据库

Java cannot write to database due to "java.sql.SQLException: Access denied for user"

我正在尝试使用 Java application 从气象站获取数据并将其写入数据库,但我一直收到异常

Sep 21, 2021 5:15:35 PM se.technipelago.weather.archive.SqlDataStore init
SEVERE: Cannot connect to database
java.sql.SQLException: Access denied for user 'weather'@'localhost'

this function.

抛出

这是我的 collector.properties 文件的样子:

datastore.type=jdbc
datastore.name=weather
datastore.jdbc.driver=com.mysql.cj.jdbc.Driver
datastore.jdbc.url=jdbc:mysql://localhost:3306/weather?user=weather&password=weather

我忽略了什么?

通过实际创建数据库解决,因为它不存在。