求助下各位,之前安装了1.4.7版本用来两年多,最近使用docker-compose安装2.7,已经停用旧版本,文件目录不冲突,但是容器一直报如下错误org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'r2dbcScriptDatabaseInitializer' defined in class path resource [org/springframework/boot/autoconfigure/sql/init/R2dbcInitializationConfiguration.class]: Failed to execute database script
,原以为是mysql的问题,安装的mysql版本8.0,后来使用内置mysql的docker-compose安装依旧是这样的报错。通过vmware虚拟机部署都正常,一直没找到问题在哪,麻烦哪位大佬解答下。
2.7版本容器启动报错,Error creating bean with name xxx Failed to execute database script
需要提供一下完整的日志。
[https://cloud.ogsun.cn/f/fd388494aa994041be01/?dl=1](https://) 完整上传到网盘了,麻烦大佬帮忙看看。
Caused by: org.springframework.dao.DataAccessResourceFailureException: Failed to obtain R2DBC Connection
at org.springframework.r2dbc.connection.ConnectionFactoryUtils.lambda$getConnection$0(ConnectionFactoryUtils.java:90) ~[spring-r2dbc-6.0.10.jar:6.0.10]
at reactor.core.publisher.Mono.lambda$onErrorMap$28(Mono.java:3783) ~[reactor-core-3.5.7.jar:3.5.7]
at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:94) ~[reactor-core-3.5.7.jar:3.5.7]
... 73 common frames omitted
Caused by: io.r2dbc.spi.R2dbcPermissionDeniedException: Access denied for user 'root'@'localhost' (using password: YES)
at io.asyncer.r2dbc.mysql.message.server.ErrorMessage.toException(ErrorMessage.java:88) ~[r2dbc-mysql-1.0.2.jar:1.0.2]
at io.asyncer.r2dbc.mysql.message.server.ErrorMessage.toException(ErrorMessage.java:73) ~[r2dbc-mysql-1.0.2.jar:1.0.2]
at io.asyncer.r2dbc.mysql.LoginExchangeable.accept(QueryFlow.java:803) ~[r2dbc-mysql-1.0.2.jar:1.0.2]
at io.asyncer.r2dbc.mysql.LoginExchangeable.accept(QueryFlow.java:748) ~[r2dbc-mysql-1.0.2.jar:1.0.2]
at reactor.core.publisher.FluxHandle$HandleConditionalSubscriber.onNext(FluxHandle.java:327) ~[reactor-core-3.5.7.jar:3.5.7]
... 45 common frames omitted
无法连接到数据库,建议提供一下你完整的部署过程,包括配置文件。
- 已编辑
@"Ryan Wang"#p20663version: "3"
services:
halo:
image: halohub/halo:2.7
container_name: halo
restart: always
network_mode: "host"
volumes:
- ./:/root/.halo2
command:
# 修改为自己已有的 MySQL 配置
- --spring.r2dbc.url=r2dbc:pool:mysql://localhost:3306/halo
- --spring.r2dbc.username=root
- --spring.r2dbc.password=dv#b6568PP65XP$Y
- --spring.sql.init.platform=mysql
# 外部访问地址,请根据实际需要修改
- --halo.external-url=https://ogsun.cn
# 初始化的超级管理员用户名
- --halo.security.initializer.superadminusername=admin
# 初始化的超级管理员密码
- --halo.security.initializer.superadminpassword=6d66fe45
# 端口号 默认8090
- --server.port=8090
MySQL登录正常,库也创建,在vmware测试同样的mysql账号密码都正常,难道和版本有关吗?
nancheng 那就有点奇怪了,我看配置似乎没有问题。