1

Trying to connect to MySQL from r:

library(RMySQL)
mydb<-dbConnect(MySQL(), user='root', password='123', dbname='mydb', host='localhost')

Getting the following error:

Error in .local(drv, ...) : Failed to connect to database: 
Error: Can't initialize character set unknown (path: compiled_in)

Using

R ver is 3.3.3
MySQL is '8.0.12'
default_character_set_name in MySQL is utf8mb4
Roman Luštrik
  • 67,056
  • 24
  • 151
  • 191
pkowalchuk
  • 21
  • 2

1 Answers1

2

I had the same issue when I installed MySQL 8.0.19 Solution is locate and open your my.cnf and set character-set for mysql server.

character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
Irungbon
  • 21
  • 4