Dear Jim,
> That error means that your user number or group is not allowed to
> access it. Did you create the new one as a different user, maybe as
> root?
Here is what I did:
I switched to root in the MySQL Server, created a new user called
user2. I GRANTed user2 all permissions to access db2. I did NOT
restart the mysql server as I think the GRANT does not need a restart
of the MySQL server.
> Jim
>
> On Thu, Oct 28, 2021 at 4:42 PM Ashim Kapoor <ashimkapoor at
gmail.com> wrote:
> >
> > Dear R - users,
> >
> > I have 2 databases on a MySQL server. I am able to access the old one
> > but not the freshly created one.
> >
> > library(RMySQL)
> > # This one is the old one, I am able to access it,
> > > con1<- dbConnect(MySQL(),host= "myserver",
db="db1", user= "user1",password ="mypass1")
> >
> > # This is the new one. I am getting an error.
> > > con2 <- dbConnect(MySQL(),host= "myserver",
db="db2", user= "user2",password="mypass2")
> > Error in .local(drv, ...) :
> > Failed to connect to database: Error: Access denied for user
> > 'user2'@'myserver' (using password: YES)
> > >
> >
> > Can someone please point me in the right direction? The error is not
> > clear. I do not think I have mistyped the credentials.
> >
> > Many thanks,
> > Ashim
> >
> > ______________________________________________
> > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.