问题描述
我正在尝试学习飞镖和渡槽。我正在关注渡槽指南。到目前为止,一切正常。但是当连接到数据库时,出现错误。
我正在使用:
Windows 10
Postresql 13
Dart 2.10.0
Aqueduct 4.0.0-b1
我收到以下错误:
*** There was an error connecting to the database 'heroes_user:password@localhost:5432/heroes'. Reason: unable to connect to database.
我可以使用psql
或DBeaver
连接到数据库,因此用户名(heroes_user),密码(password)和数据库(heroes)正确。
我从Aqueduct 3开始,但是在搜索错误后,我发现其他人也遇到了类似的问题,建议是升级到Aqueduct4。因此,我执行了pug get + update pubspec.yaml
+ pub global Activate aqueduct 4.0.0-B1
。这没有任何进展。
我发现的其他建议是更改密码身份验证方法。我修改了pg_hba.conf
使其包含以下行:
host all all 127.0.0.1/32 md5
但这也没有成功。
我不确定该朝哪个方向搜索。我注意到类似的问题,但没有实际答案。 有什么建议吗?
解决方法
已解决。问题似乎与PostgreSQL 13有关。 我安装了PostgreSQL 12.4,然后运行命令来创建数据库迁移文件。然后运行数据库更新命令,该命令立即生效。