R 语言写入 RMySQL 中文乱码

问题提出:

解决问题场景:

解决过程:

conn <- dbConnect(MySQL(), dbname = "test", username="呵呵", password="哈哈", host="娃娃", port=3306)
#操作数据库,解码
dbSendQuery(conn,'SET NAMES gbk')
#1.读取表
dbReadTable(conn, "tb_item")
#查看表
print(a)
View(a)
#关闭数据库
dbDisconnect(conn) 

待解决的问题:

写进的中文字段表出现问题

参考:

https://blog.csdn.net/YAJUN0601/article/details/68487732

猜你喜欢

转载自blog.csdn.net/OYY_90/article/details/82146290