Reputation: 1245
I am trying to connect to MySQL hosted on AWS free tier.
For some reason I am getting an error stating my database is not found. I was wondering what I am doing wrong.
Below is my code along with a picture stating what my database name is on AWS.
library(dplyr)
library(dbplyr)
library(pool)
host = "database1.creyniq1gyij.us-east-2.rds.amazonaws.com"
dbname = "database1"
user = "jordan1"
pass = "mysecurepass"
con <- dbPool(RMySQL::MySQL(),
username=user,
password=pass,
host=host,
port=3306,
dbname="database1"
)
Error in .local(drv, ...) :
Failed to connect to database: Error: Unknown database 'database1'
Here is my amazon screen shot of my database
From @makeshift-programmer answer, I removed dbname in the call and I was able to connect. However, I am not to sure how to create a dbname/schema, so I can start uploading data into the sever.
Upvotes: 1
Views: 2005
Reputation: 499
Could you remove the dbname
argument and try to connect?
As per the screenshot, it looks like you have named the instance but not created a DB on it.
If the database connection succeeds without dbname
, you can then proceed to create a DB on that RDS instance.
To create a DB use the following query from RMySQL
package:
dbSendQuery(con,"create database database1")
Upvotes: 2
Reputation: 68715
database1
is the database instance identifier, not the actual schema/database name. Have you created a schema? If not then u can try to connect to a default schema such as test/mysql.
Upvotes: 0