I am trying to run sqldf in R in Rstudio. However, it produced an error asking for a password even when a password was given (shown in box 1).
I made sure that my password was OK by typing mysql -u scottyiu -p
into the terminal and then my password. It is successful and I can get into mysql. I am stuck and will really appreciate some help.
Box 1:
> sqldf("select pwgtp1 from acs where AGEP < 50", password="My password", host = "localhost")
Error in mysqlNewConnection(drv, ...) :
RS-DBI driver: (Failed to connect to database: Error: Access denied for user 'scottyiu'@'localhost' (using password: NO))
Error in !dbPreExists : invalid argument type
Box 2:
mysql -u scottyiu -p
mysql> CREATE USER 'scottyiu'@'localhost' IDENTIFIED BY 'my password';
mysql> GRANT ALL PRIVILEGES ON * . * TO 'scottyiu'@'localhost';
mysql> FLUSH PRIVILEGES;