I’m newbie to R with RStudio using Mac(OS X).
I successfully use sequel Pro to see DB with like this.
I use dbConnect with RMySQL and DBI(below code) with RStudio.
library(DBI)
library(RMySQL)
con <- dbConnect(RMySQL::MySQL(),
username = "username",
password = "password",
host = "hostname-xxx.ap-northeast-1.rds.amazonaws.com",
port = 3306,
dbname = "dbname"
)
but I've got below error.
Error in .local(drv, ...)
Failed to connect to database: Error: Access denied for user 'username'@'yyyyyyyyyyymarunouchi.tokyo.ocn.ne.jp' (using password: YES)
So ssh tunnel like this using terminal.
ssh -f sshuser@xx.xxx.xx.xx -i ~/.ssh/ssh_key -L 3306:hostname-xxx.ap-northeast-1.rds.amazonaws.com:3306 -N
and successfully logined.
after that, in order to confirm, executed below command(in terminal) but failed after entering correct password.
mysql -h 127.0.0.1 -p -u username dbname
with error code
ERROR 1044 (42000): Access denied for user 'username'@'localhost' to database 'dbname'
(other machine with same username successfully login. I didn't know why...)
and dbConnect(RMySQL with RStudio) is showing same above error.
Anyone same situation? Please tell me what to do.
Thank you.