
我无法连接到 golang 应用程序中的 azure postgresql 数据库
错误消息:
fatal: invalid username specified. please check the username and retry connection. the username should be in <username@hostname> format. (sqlstate 28000))
我的用户名中没有@。
我使用 gorm 作为 orm 并像这样连接
dburl := fmt.sprintf("postgres://%s:%s@%s:5432/%s", dbuser, dbpass, dbhost, dbname)
db, err := gorm.open(postgres.open(dburl), &gorm.config{})
我的变量看起来像这样
postgres_password="password!" db_host="some-url-with-dashes.postgres.database.azure.com" app_port="8080" postgres_user="postgresuser" db_name="file"
我的代码确实看到了它们并正确创建了 dburl ,如下所示:
postgres://postgresuser:[email protected]:5432/file
我已尝试更改用户名和密码
您必须配置参数db_user_namespace 到 on。不要这样做。
以上就是无法连接到 azure PostresSQL 数据库 - 用户名应采用 格式的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号