springboot本地成功连接mysql但deploy后连接不上
Springboot successfully connects to mysql locally but can't connect after deploy
我在 Mac 上使用 mysql 5.7 开发 springboot 应用程序,没有任何问题。
这是我的属性:
logging.level.root=WARN
logging.level.org.springframework.web=DEBUG
logging.level.org.hibernate=ERROR
server.port=8091
spring.datasource.url=jdbc:mysql://localhost:3306/dbName
spring.datasource.username=useraa
spring.datasource.password=password
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.jpa.show-sql=false
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.hibernate.use-new-id-generator-mappings=true
spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
spring.jpa.properties.hibernate.format_sql = false
spring.jpa.properties.hibernate.default_schema=USERAA
在我使用 mvn clean install
部署并上传到我在 Digital Ocean 上的服务器后,当我使用命令 java -jar [=22= 运行 .jar 时显示此错误消息]
java.sql.SQLException: Access denied for user 'useraa'@'localhost' (using password: YES)
with ERROR 28538 com.zaxxer.hikari.pool.HikariPool : testdb - Exception during pool initialization.
我已经检查了我的防火墙设置,我允许该端口,我可以使用 ssh/phpmyadmin 和用户名 'useraa' 连接到 mysql。
我还在 ssh 中尝试了一个 CRUD 命令。
您正在连接到 MySQL,但它没有对您进行身份验证。
- 检查您的用户名和密码是否正确
- 检查您的用户名是否可以从本地主机访问
- 检查您的用户名对架构有权限
我在 Mac 上使用 mysql 5.7 开发 springboot 应用程序,没有任何问题。 这是我的属性:
logging.level.root=WARN
logging.level.org.springframework.web=DEBUG
logging.level.org.hibernate=ERROR
server.port=8091
spring.datasource.url=jdbc:mysql://localhost:3306/dbName
spring.datasource.username=useraa
spring.datasource.password=password
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.jpa.show-sql=false
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.hibernate.use-new-id-generator-mappings=true
spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
spring.jpa.properties.hibernate.format_sql = false
spring.jpa.properties.hibernate.default_schema=USERAA
在我使用 mvn clean install
部署并上传到我在 Digital Ocean 上的服务器后,当我使用命令 java -jar [=22= 运行 .jar 时显示此错误消息]
java.sql.SQLException: Access denied for user 'useraa'@'localhost' (using password: YES)
with ERROR 28538 com.zaxxer.hikari.pool.HikariPool : testdb - Exception during pool initialization.
我已经检查了我的防火墙设置,我允许该端口,我可以使用 ssh/phpmyadmin 和用户名 'useraa' 连接到 mysql。 我还在 ssh 中尝试了一个 CRUD 命令。
您正在连接到 MySQL,但它没有对您进行身份验证。
- 检查您的用户名和密码是否正确
- 检查您的用户名是否可以从本地主机访问
- 检查您的用户名对架构有权限