错误:R 无法连接到 MySQL [英] Error: R cannot connect to MySQL

查看:69
本文介绍了错误:R 无法连接到 MySQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

昨天我将 MySQL 更新到最新版本 8.0.11 并尝试使用 RMySQL 连接到 MySQL,但它不起作用,我找不到任何解决方案.

I updated MySQL to latest version 8.0.11 yesterday and tried to use RMySQL to connect to MySQL, but it was not working and I could not find any solution.

我的代码:

library(RMySQL) 
con <- dbConnect(MySQL(), user="hello", password="hi", dbname = "webscrape", host="xx.xxx.xxx.xxx", port=xxxx)

错误:

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

推荐答案

我是这样解决这个问题的:

I solved this problem like this:

用户窗口

1. .local(drv, ...) 中的错误:无法连接到数据库:错误:无法初始化未知字符集(路径:compiled_in)

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

添加这些行后:

文件路径:%PROGRAMDATA%\MySQL\MySQL Server X.X\my.ini

    [mysqld]
    collation-server = utf8_unicode_ci
    init-connect='SET NAMES utf8'
    character-set-server = utf8
    skip-character-set-client-handshake

    [client]
    default-character-set   = utf8

    [mysql]
    default-character-set   = utf8

2- 无法加载身份验证插件caching_sha2_password"

2- Authentication plugin 'caching_sha2_password' cannot be loaded

    ALTER USER 'yourusername'@'localhost' IDENTIFIED WITH mysql_native_password BY 'youpassword';

参考文献:

MySQL my.ini 位置

更改 MySQL 默认值my.cnf 中的字符设置为 UTF-8?

无法加载身份验证插件caching_sha2_password"

这篇关于错误:R 无法连接到 MySQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆