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

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1745508702, '3.145.36.157', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/R/packages/RMySQL/index(77): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78