我正在从RSQLite
to移动,我对and字段RMySQL
感到困惑。FWIW,我正在运行 Windows 7、R 2.12.2、MySQL 5.5(全 64 位)和 RMySQL 0.7-5。user
password
我按照上一个 SO questionRMySQL
中的规定进行了安装,据我所知它可以工作(即,我可以使用 加载包)。但是,当我尝试从R 数据导入指南运行教程时,我收到“无法连接到数据库...”错误。这是指南中的教程中的代码:library(RMySQL)
library(RMySQL) # will load DBI as well
## open a connection to a MySQL database
con <- dbConnect(dbDriver("MySQL"), user = "root", password = "root", dbname = "pookas")
## list the tables in the database
dbListTables(con)
## load a data frame into the database, deleting any existing copy
data(USArrests)
dbWriteTable(con, "arrests", USArrests, overwrite = TRUE)
dbListTables(con)
## get the whole table
dbReadTable(con, "arrests")
## Select from the loaded table
dbGetQuery(con, paste("select row_names, Murder from arrests",
"where Rape > 30 order by Murder"))
dbRemoveTable(con, "arrests")
dbDisconnect(con)
在第二行我收到以下错误:
> con <- dbConnect(dbDriver("MySQL"), user = "richard", password = "root", dbname = "pookas")
Error in mysqlNewConnection(drv, ...) :
RS-DBI driver: (Failed to connect to database: Error: Access denied for user 'richard'@'localhost' (using password: NO)
)
我尝试过使用和不使用user
以及password
使用 admin 作为user
. 我也尝试过使用dbname
我之前在命令行中制作的一个和一个不存在的。
有小费吗?这里有很好的参考吗?谢谢!