gpt4 book ai didi

Why is Mariadb behaving differently when access it via PuTTY or via R?(为什么MariaDB在通过PuTTY或R访问它时表现不同?)

转载 作者:bug小助手 更新时间:2023-10-24 21:47:22 25 4
gpt4 key购买 nike



Rephrasing a previous question. I am trying to understand why I can get access to Mariadb via SSH over PuTTY but not over R. I'm using Windows 11 v. 22H2; server is hosted with cpanel.

换句话说之前的问题。我正在尝试理解为什么我可以通过PuTTY上的SSH访问MariaDB,但不能通过R访问。我使用的是Windows 11 v.22H2;服务器是由cPanel托管的。


Opening the connection over PuTTY, I can log in Mariadb using

通过PuTTY打开连接,我可以使用以下命令登录MariaDB


mysql -u USER -p;

And from there I can show databases; and perform other SQL queries.

从那里我可以显示数据库;并执行其他SQL查询。


However, from R, after connecting via SSH, I cannot open a connection to Mariadb. In R, this fails:

但是,从R通过SSH连接后,我无法打开到MariaDB的连接。在R中,此操作失败:


mysqlconnection = dbConnect(RMySQL::MySQL(),
host='localhost',
user='USER',
password='PW')

With either "cannot connect to server" or "host is not allowed to connect to this MariaDB server)

带有“无法连接到服务器”或“主机不允许连接到此MariaDB服务器”)



NOTE: I'm working on contacting the right ppl in order to add a user as
described in
Host 'xxx.xx.xxx.xxx' is not allowed to connect to this MySQL server
... but I don't even understand WHY I need to do it since it works
in PuTTY, using the exact same credentials.



I also tried to connect using

我也试着用


ssh_exec_wait(ssh_connection, command = 'mysql -u USER -p' )

worst case scenario R crashes; best case scenario the console prompts for a password but I cannot figure how to input it (yes, I tried typing it in the console an pressing Enter. Doesn't do anything.) I receive messages that R is responding to OpenSSH's keepalive.

最坏的情况R崩溃;最好的情况控制台提示输入密码,但我不知道如何输入(是的,我尝试在控制台中输入密码并按Enter键。不执行任何操作。)我收到消息,R正在响应OpenSSH的Keeplive。


The whole message:

整个信息是:


channel_open: Creating a channel 43 with 64000 window and 32768 max packet
ssh_packet_global_request: Received SSH_MSG_GLOBAL_REQUEST packet
ssh_packet_global_request: UNKNOWN SSH_MSG_GLOBAL_REQUEST [email protected], want_reply = 0
ssh_packet_global_request: Invalid SSH_MSG_GLOBAL_REQUEST packet
ssh_packet_ignore_callback: Received SSH_MSG_DEBUG packet
ssh_packet_channel_open_conf: Received a CHANNEL_OPEN_CONFIRMATION for channel 43:0
ssh_packet_channel_open_conf: Remote window : 0, maxpacket : 32768
channel_rcv_change_window: Adding 2097152 bytes to channel (43:0) (from 0 bytes)
channel_request: Channel request exec success
grow_window: growing window (channel 43:0) to 1280000 bytes
Enter password: channel_rcv_request: Responding to Openssh's keepalive

So, I am trying to learn and understand why I can connect with PuTTY, but not R?

所以,我正在努力学习和理解为什么我可以连接到PuTTY,而不是R?


更多回答

What does select user(); return when you login via the MySQL client?

当您通过MySQL客户端登录时,SELECT USER();返回什么?

If you use putty via ssh, then the connection is made as if the client was on the same server your mariadb. When you connect from R, then you connect remotely.

如果通过ssh使用PuTTY,则连接就像客户端与您的MariaDB位于同一服务器上一样。当你从R连接时,你就可以远程连接。

Can you confirm whether or not you are first connecting to the server using SSH and then running R? Your first comment "from R, after connecting via SSH" suggests that you are but then ssh_exec_wait(ssh_connection, command = 'mysql -u USER -p' ) suggests that you are not.

您能否确认是否先使用SSH连接到服务器,然后运行R?您的第一条评论“from R,After with SSH”表明您是这样做的,但是ssh_exec_Wait(ssh_Connection,Command=‘mySQL-u user-p’)表明您不是这样做的。

@neilfws I tried pretty much all variation: SSH first, then R; SSH first +SSH in R; SSH in R only. always the same result.

@neilfws我尝试了几乎所有的变体:首先是SSH,然后是R;首先是SSH+R中的SSH;只有R中的SSH。结果总是一样的。

OK, I don't think we can help more without knowing how the server is set up. Hopefully those "right ppl" can.

好吧,我想在不知道服务器是如何设置的情况下,我们无法提供更多帮助。希望那些“对的人”能做到。

优秀答案推荐

Are you sure that you're db server is listenning you'r R client ? mysql native client is probably rputed to a local socket when R is not.

您确定您的数据库服务器正在监听您的R客户端吗?MySQL本机客户端可能被转换为本地套接字,而R不是。


更多回答

no idea how to check that. Any pointers?

我不知道该怎么查。有什么建议吗?

mariadb.com/kb/en/configuring-mariadb-for-remote-client-access

Mariadb.com/kb/en/configuring-mariadb-for-remote-client-access

Or in R unix.socket. Look at \s on the mysql client when connected to see how it connected.

或者是R unix。Socket。看一下MySQL客户端上的\S,看看它是如何连接的。

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com