Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error in evaluating the argument 'drv' in selecting a method for function 'dbConnect': could not find function "MySQL"

I am getting an error message " error in evaluating the argument 'drv' in selecting a method for function 'dbConnect': could not find function "MySQL""

Here is the part of the code:

library(DBI) 
conn <- dbConnect( drv = RMySQL::MySQL(), dbname = "xxx", host = "xxx", username = "xxx", password = "new_password") 
dbGetQuery(conn, "SELECT * FROM tech LIMIT 1;") 
dbDisconnect(conn)
like image 450
Mahmood Avatar asked Sep 07 '25 00:09

Mahmood


1 Answers

If you're using a script in an interactive session, call library(RMySQL) to load the package.

If you get this error while developing a package, add RMySQL to the Imports field of your DESCRIPTION file. You can do that with usethis::use_package("RMySQL").

like image 134
Sam Firke Avatar answered Sep 10 '25 03:09

Sam Firke