MySQL database in R studio

I want to access MySQL database in R studio but when i try the code below, it throws up this error:

Error: nanodbc/nanodbc.cpp:1021: 00000: [unixODBC][Driver Manager]Can't open lib 'MySQL ODBC 8.0 ANZI Driver' : file not found

Code:
library(RODBC)
conn3 <- DBI::dbConnect(odbc :: odbc(),
Driver = "MySQL ODBC 8.0 ANZI Driver",
Server = "localhost",
user = "root",
password = "jaymo247365",
Database = "firstproject",
trusted_connection = "yes",
port = 3306
)

How do i solve this?

Are you sure about the name of your driver? Should it really be "ANZI", not "ANSI"? Where did you download the driver from?

Does the connection work using RMariaDB? e.g. with:

DBI::dbConnect(RMariaDB::MariaDB(),
    user = "xxxx",
    password = "xxxx",
    Database = "firstproject",
    trusted_connection = "yes",
    port = 3306
)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.