Connecting R Studio with SQL Server (hosted in AWS Amazon)

Hello Everyone!

I am about 3 days trying to resolve this problem without sucess.

I have a SQL Server hosted in AWS Amazon. I use PHP MyAdmin to acess the server normally.

Now, I'm trying to connect R Studio with my SQL

My code:

install.packages("RMySQL")

library(DBI)

library(RMySQL)

con = dbConnect (MySQL(), 

                 dbname = "aaaaaa", 

                 host = "[52.67.xx.xxx]",

                 user = "root", 

                 password = "xxxxxxx"

                 )

The result:

Error in .local(drv, ...) : 

  Failed to connect to database: Error: Can't connect to MySQL server on '[52.67.xx.xxx](http://52.67.xx.xxx/)' (0)
  • I already tried to put Port 3306 without sucess;

  • I have already added my own IP on the group security on the Instance AWS;

Any Solution?

Thanks!

I have never configured MySQL server but if it's similar to PostgreSQL it must have a config file where you need to set the listen parameter, somthing similar to listen_addresses='*'

Also you may want to try RMariaDB package insted of RMySQL

RMariaDB is a database interface and MariaDB driver for R. This version is aimed at full compliance with the DBI specification, as a replacement for the old RMySQL package.

EDIT: For MySQL the config file you have to find is my.cnf and the parameter you have to change is bind-address = 0.0.0.0 wich allows any ip to connet, or you can specify your current ip address