= "scalecheck:WuLsUDAdDYja@tcp(122.112.186.54:3306)/scalecheck?charset=utf8mb4&parseTime=True&loc=Local"
dsnk8
postgres 创建用户,创建库
create user aca with password '';
create database hwapi owner 'aca';
在postgresql.conf 中开启
listen_addresses = '*'
在pg_hba.conf 中允许认证方式,
# TYPE DATABASE USER CIDR-ADDRESS METHOD
host all all 0.0.0.0/0 md5
重启postgres生效。
ent里面连接pg
_ "github.com/lib/pq"
client, err := ent.Open("postgres",
"host=127.0.0.1 port=5432 user=aca dbname=yy password=xxx sslmode=disable")
感觉跟mysql差不多。