mysqlrrmysql

Trouble with connecting R to MySQL database using tcpl R package


I have a database stored in MySQL and need to connect to it in R using the tcpl R package.

I tried connecting using the following:

tcplConf(user='root', password= YOUR_PW, db='prod_internal_invitrodb_v4_1', drvr='MySQL', host='localhost')

This however keeps giving an error: Error: Failed to connect: Access denied for user 'root'@'localhost' (using password: NO)

When I try connecting with dbConnect(), it works:

con <- dbConnect(drv = RMySQL::MySQL(), user='root', password=YOUR_PW, db='prod_internal_invitrodb_v4_1', host='localhost')

I don't think it's an authentication issue. Does anyone have some advice on how to resolve this establish a connection using tcplConf()?


Solution

  • Update: the connection issue with tcpl R package has been resolved. Because I had run and used RMySQL to establish a connection with the MySQL database, it was interfering with the authentication and establishing a connection using tcplConf().

    unloadNamespace("RMySQL")
    

    After this, I ran tcplConf() which worked fine.