R语言连接MySQL报错:could not run statement: The used command is not allowed with this MySQL version

Posted 王亨

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了R语言连接MySQL报错:could not run statement: The used command is not allowed with this MySQL version相关的知识,希望对你有一定的参考价值。

版本说明

R版本:3.5

mysql版本:8.0

RMySQL版本:0.10.19

情景说明:

使用RMySQL成功连接到MySQL数据库,可以进行查询操作,但在插入时报错,提示信息如下:

con <- dbConnect(MySQL(), host="127.0.0.1", dbname="epid", user="root", password="1234")
dbWriteTable(con,"city_dt",city,overwrite =FALSE,append=TRUE,row.names=FALSE)

报错信息具体如下:

Error in .local(conn, statement, ...) :
 could not run statement: The used command is not allowed with this MySQL version

解决方法:

 

install.packages("RMariaDB")
install.packages("zeallot")
library(RMariaDB)
library(zeallot)
con <- dbConnect(MariaDB(), host="127.0.0.1", dbname="epid", user="root", password="1234")
dbWriteTable(con,"city_dt",city,overwrite =FALSE,append=TRUE,row.names=FALSE)

数据成功插入数据库;

 

欢迎关注我的微信公众号 简书:数据志

 

以上是关于R语言连接MySQL报错:could not run statement: The used command is not allowed with this MySQL version的主要内容,如果未能解决你的问题,请参考以下文章

本地连接远程mysql服务报错:MySQL is running but PID file could not be found [FAILED]

本地连接远程mysql服务报错:MySQL is running but PID file could not be found [FAILED]

jmeter连接mysql数据库报错Cannot create PoolableConnectionFactory (Could not create connection to database s

PB通过ODBC连接mysql数据库,报错:catalog tables could not be created and are not available for use

Idea连接MySQL异常[Could not create connection to database server. Attempted reconnect 3 times.]

Idea连接MySQL异常[Could not create connection to database server. Attempted reconnect 3 times.]