Question

My problem is that I am able connect database without using password and also able execute the queries but when I am trying to connect database with password it is giving error. The details I have mentioned below what I am doing and what is the error:

>library(DBI)
>library(RMySQL)
>drv<-dbDriver("MySQL")
>con<-dbConnect(drv,user="sam",password="sam123",dbname="test")

then the error is like:

Error in mysqlNewConnection(drv, ...) : 
  RS-DBI driver: (Failed to connect to database: 
  Error: Access denied for user 'sam'@'localhost' (using password: YES)

Please help me out of this problem.

Was it helpful?

Solution

It seems permission issue for usr "sam" in your database.

You should check mysql.users table and provide necessary permissions, if you are trying to access from remote server, you should add IP address of remote server in users table with username ="sam"

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top