我正在尝试连接到我的本地主机 postgres 数据库,但出现以下错误。
library("RPostgreSQL")
drv <- dbDriver("PostgreSQL")
connec <- dbConnect(drv, dbname = "dbnamehere", port = 5432,user = "some_username", password = "somepassword")
Error in postgresqlNewConnection(drv, ...) :
RPosgreSQL error: could not connect admin_sci4i@localhost:5432 on dbname "website": SCRAM authentication requires libpq version 10 or above
它似乎与身份验证安全性有关,但我有一个本地数据库..有什么方法可以在 pgAdmin 4 中执行任何操作并避免此错误(即使它不太安全)?
令人惊讶的是我设法使用其他软件包进行连接
library("RODBC")
library("odbc")
library("RPostgres")
con <- dbCanConnect(RPostgres::Postgres(),dbname="dbnamehere",port = 5432,user = "some_username", password = "somepassword")
con # Checks connection is working
con1 = dbConnect(RPostgres::Postgres(),dbname="dbnamehere",port = 5432,user = "some_username", password = "somepassword")
con1 # Checks connect
dbListTables(con1) # See tables
library("RPostgres")
library(DBI)
# Connect to postgres database
con <- DBI::dbConnect(RPostgres::Postgres(), dbname = dbname,
host = host, port = port, user = user,
password = rstudioapi::askForSecret("password"))
## Get a list of tables in the database
dbListTables(con)