Search notes:

R package: RMySQL

RMySQL is the MySQL DBI backend.

Connect to a MySQL database

library(RMySQL)

mySQL = dbConnect(
          MySQL(),
          user     = 'rene',
          password = 'mySecretGarden',
          dbname   = 'theDB',
          host     = 'localhost');

Fixing connection problems

Error in .local(drv, ...) : Failed to connect to database: Error: Can't initialize character set unknown (path: compiled_in):
Adding or modifying the following sections in the MySQL Server Instance configuration file helped
[client]
default-character-set   = utf8

[mysql]
default-character-set   = utf8

[mysqld]
collation-server = utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-server = utf8
skip-character-set-client-handshake
Error in .local(drv, ...) : Failed to connect to database: Error: Plugin caching_sha2_password could not be loaded: The specified module could not be found. needed the following to fix
alter user rene@'%'
      identified with mysql_native_password by 'rene';
This Stackoverlfow answer was very helpful in fixing these issues.

See also

MySQL
R packages

Index