0

I have created a database on AWS using MySQL. It is Publicly Accessible, but when I try to connect to it using the DBI package in R. I get this error message. The master username is 'jman88' on AWS. If you need certain data fields please let me know and I will post (I am new to creating databases so I am not to sure which information would be useful to help you solve it). Thank you!

Here is the code I currently have followed by the error message. con =

library(DBI)
library(RMySQL)
dbConnect(MySQL(),
         dbname = 'test1db',
         host = '*******',
         user = 'jman88',
         password = '*******', 
         port = 3306 
            )
Error in .local(drv, ...) : 
Failed to connect to database: Error: Access denied for user 
'jman88'@'***********' (using password: YES)
Jordan Wrong
  • 1,205
  • 1
  • 12
  • 32
  • 1
    The error is exactly what it says, you have the wrong username/password/host. Have you tried running a `mysql -u jman88 -p{password} -h {host}` (no space between `-p` and password) on the server as comparison. – danblack Feb 05 '19 at 22:19
  • This is the exact string I've used to successfully connect to MySQL on RDS in the past: `con <- dbConnect(RMySQL::MySQL(), user = secret$user, password = secret$password, host = '.us-west-2.rds.amazonaws.com', dbname= '')`. Make sure you're using the correct `host` url. Also, I didn't need to specify the `port` although I can't imagine that would break it. `secret` is just a `JSON` with credentials. – Mako212 Feb 05 '19 at 22:31
  • @Mako212 the error message comes from the mysql server, so it is unlikely to be a driver issue. – Shadow Feb 05 '19 at 22:35
  • @Shadow I only mentioned because pre-edit, OP had `library(MySQL)` and not `library(RMySQL)` – Mako212 Feb 05 '19 at 22:36
  • Also, check your Inbound security group configuration. If you haven't opened up access to port 3306 to (at a minimum) your IP address, you won't be able to connect. – Mako212 Feb 05 '19 at 22:40
  • @Shadow, top level access rules for MySQL on RDS are controlled via Security Groups, and so the solution here may be related to RDS security groups, and not MySQL level permissions, so I'm not sure this is a duplicate. – Mako212 Feb 05 '19 at 22:43
  • @Mako212 if the port is not opened up, then the error message would be can't connect to mysql, as opposed to the access denied error message. The mysql access denied error message means that the mysql client successfully estalished the connection to mysql, but then could not authenticate the user. – Shadow Feb 05 '19 at 22:57

0 Answers0