rmysql-错误:无法初始化未知的字符集

时间:2018-10-02 17:55:12

标签: mysql r

尝试从r连接到MySQL:

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

出现以下错误:

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

使用

R ver is 3.3.3
MySQL is '8.0.12'
default_character_set_name in MySQL is utf8mb4

1 个答案:

答案 0 :(得分:0)

我安装MySQL 8.0.19时遇到了同样的问题 解决方法是找到并打开my.cnf并为mysql服务器设置字符集。

character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci