使用 Perl 连接远程服务器上的 MySQL 数据库时出现问题
我有一个 Perl 脚本,它从一台服务器(让我们称之为 server1)上的 MySQL 数据库获取数据,对其进行处理并将其写入另一台服务器(server2)上的另一个数据库。两台服务器都位于运行 Perl 脚本的服务器的远程。
我可以正常连接到 server1 上的数据库,但是当我尝试使用相同的 DBI 方法连接到 server2 上的数据库时,出现错误。这里,作为命令行 Perl,是导致错误的位:
perl -MDBI -e 'DBI->connect("DBI:mysql:myDB:server2.whatever.co.uk","myuser" ,"mypassword") 或 die DBI->errstr;'
这是错误消息:
DBI connect('myDB:server2.whatever.co.uk','myuser',...) failed:客户端不支持服务器请求的认证协议;考虑在 -e 第 1 行升级 MySQL 客户端 客户端不支持服务器请求的认证协议;考虑在 -e 第 1 行升级 MySQL 客户端。
我没有 root 访问权限,因此无法升级 MySQL,也无法更改密码以使用旧的密码哈希算法,这是很多建议的解决方案的地方。
有人有想法吗?
I have a Perl script that gets data from a MySQL database on one server (let's call it server1), does stuff with it and writes it out to another database on another server (server2). Both servers are remote to the server that runs the Perl script.
I can connect to the DB on server1 OK, but when I try to connect to the DB on server2, using the same DBI method, I get an error. Here, as command-line Perl, is the bit that's causing the error:
perl -MDBI -e 'DBI->connect("DBI:mysql:myDB:server2.whatever.co.uk","myuser","mypassword") or die DBI->errstr;'
And here's the error message:
DBI connect('myDB:server2.whatever.co.uk','myuser',...) failed: Client does not support authentication protocol requested by server; consider upgrading MySQL client at -e line 1
Client does not support authentication protocol requested by server; consider upgrading MySQL client at -e line 1.
I do not have root access so I can't upgrade MySQL and I can't change the password to use the old password hashing algorithm, which is the solution suggested in lots of places.
Ideas anyone?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
作为安全措施,数据库可以设置为仅接受来自特定地址集的连接。因此,如果您尝试从家用笔记本电脑(例如)访问产品数据库,即使您拥有正确的凭据,它也可能会拒绝您。尝试从已知可以使用其他技术工作的地方访问它 - 例如,如果您已经有一个可以访问它的网站,请转到 apache/tomcat 正在运行的地方,并在那里尝试 perl。如果它有效,那就是问题所在。您还可以主动检查数据库设置。
The database may be set up to accept connections only from within a certain set of addresses, as a security measure. So if you're trying to access a prod database from a home laptop (for example), it may reject you, even if you have the proper credentials. Try accessing it from a place where it's known to work using another technology -- for example, if you have a website that accesses it already, go to wherever apache/tomcat is running, and try the perl there. If it works, that's the issue. You can also proactively check on the database settings.
好吧,在没有替代方案的情况下,我找了一个对 server2 有 root 访问权限的人来修复其他地方发布的问题:
以 MySQL root 用户身份连接到 MySQL,然后:
mysql>使用mysql;
mysql>设置“用户名”@“主机名”的密码 = OLD_PASSWORD('密码');
mysql> FLUSH PRIVILEGES;
用适当的值替换“用户名”、“主机名”和“密码”。
所以我在这里想说的是,如果你没有 root 访问权限来升级 MySQL 或更改密码以使用旧的密码哈希算法,那么唯一的解决方案就是找到这样做的人< /em> 谁可以为您做出改变。
OK, in the absence of an alternative, I got someone with root access to server2 to do the fix that's published elsewhere:
Connect to MySQL as the MySQL root user, then:
mysql> use mysql;
mysql> SET PASSWORD FOR 'username'@'hostname' = OLD_PASSWORD('password');
mysql> FLUSH PRIVILEGES;
Replacing 'username', 'hostname' and 'password' with appropriate values.
So what I'm saying here is, it seems like if you don't have root access to upgrade MySQL or to change the password to use the old password hashing algorithm, then the only solution is to find someone who does who can make the change for you.