我想使用RStudio连接到MySQL数据库。我收到以下错误:
...
@Html.DropDownListFor(model => model.PDFIdentifier.PDFIdentifierID, (
IEnumerable<SelectListItem>)ViewBag.PDFsIDList, "Select Location", new {
@class = "form-control" })
...
我的代码如下:
Error: nanodbc/nanodbc.cpp:950: 08S01: [MySQL][ODBC 8.0(a) Driver]Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
我的odbc.ini如下:
library(DBI)
library(odbc)
sort(unique(odbcListDrivers()[[1]]))
odbcListDrivercon <- DBI::dbConnect(odbc::odbc(),
Driver = "MySQL Driver")
我的odbcinst.ini看起来像
[PostgreSQL Driver]
Driver = /usr/local/lib/psqlodbcw.so
[SQLite Driver]
Driver = /usr/local/lib/libsqlite3odbc.dylib
[MySQL Driver]
Description = ODBC for MySQL
Driver = /usr/local/mysql-connector-odbc-8.0.15-macos10.14-x86-64bit/lib/libmyodbc8w.so
对于这些,我填写了实际值。
我不确定我在连接时做错了什么。