gpt4 book ai didi

mysql - 如何使用 perl 在 Windows V10 上访问 mysql V8?

转载 作者:行者123 更新时间:2023-11-29 07:18:44 24 4
gpt4 key购买 nike

我很困惑,这太难了。

(1) 使用 activate state perl v5.26.3 我使用 ppm.bat 并搜索 mysql,但缺少 DBD-mysql。根据 https://code.activestate.com/ppm/DBD-mysql/我试试

ppm install DBD-mysql

我得到:

ppm install failed: Can't find any package that provides DBD-mysql

(2) 使用相同的 activestate perl 的 ppm.bat 我看到了 mysqlPP,这也不适用于 MySQL V8:

perl -MDBI -e '$cat=$ENV{"MYSQLDATABASECATALOG"}; $svr=$ENV{"MYSQLHOST"}; $user=$ENV{"DATABASEUSER"}; $pass=$ENV{"DATABASECATALOGPASSWORD"}; my $dbh=DBI->connect("dbi:mysqlPP:database=$cat;host=$svr",$user,$pass,{ RaiseError => 1 }) or die "Cannot connect to $data_source: $DBI::errstr"; my $q=$ARGV[0]; my $sth=$dbh->prepare($q) or die "Cannot prepare statement: $DBI::errstr"; $sth->execute(); ... $sth->finish(); $dbh->disconnect;'  "<query goes here>"

DBI connect('database=sqlpocket;host=localhost','sqlpocket',...) failed: #08004Client does not support authentication protocol requested by server; consider upgrading MySQL client at C:/Perl64/site/lib/DBD/mysqlPP.pm line 116.

(3) Strawberry perl 假设已经安装了 DBD for mysql 但它也不起作用:

perl -MDBI -e '$cat=$ENV{"MYSQLDATABASECATALOG"}; $svr=$ENV{"MYSQLHOST"}; $user=$ENV{"DATABASEUSER"}; $pass=$ENV{"DATABASECATALOGPASSWORD"}; my $dbh=DBI->connect("dbi:mysql:dbname=$cat",$user,$pass,{ RaiseError => 1 }) or die "Cannot connect to $data_source: $DBI::errstr"; my $q=$ARGV[0]; my $sth=$dbh->prepare($q) or die "Cannot prepare statement: $DBI::errstr"; $sth->execute(); ... $sth->finish(); $dbh->disconnect;'  "<sql query goes here>"

我明白了

install_driver(mysql) failed: Can't load 'C:/perlstrawberry/5.30.0.1/perl/vendor/lib/auto/DBD/mysql/mysql.xs.dll' for module DBD::mysql: load_file:The specified module could not be found at C:/Users/2207458/Documents/AppBin/perlstrawberry/5.30.0.1/perl/lib/DynaLoader.pm line 193.
Perhaps a required shared library or dll isn't installed where expected.

这很奇怪,因为“C:/perlstrawberry/5.30.0.1/perl/vendor/lib/auto/DBD/mysql/mysql.xs.dll”存在并且可以访问。

2019 年 8 月 30 日更新:

对不起,我试图不那么冗长而变得草率:我从上面的文件名中删除了“Users/2207458/Documents/AppBin”(但我不一致)。所以 C:/perlstrawberry/5.30.0.1/perl/vendor/lib/auto/DBD/mysql/mysql.xs.dll 真的是 c:/Users/2207458/Documents/AppBin/perlstrawberry/5.30.0.1/perl/vendor/lib/auto/DBD/mysql/mysql.xs.dll.

PERL5LIB 从未被定义过。有必要吗?

最佳答案

The answer for windows (and apparently linux) is here: Lefred's Blog

我发出了这条命令并重置了密码:

alter user 'fred' identified   with 'mysql_native_password' by 'mysecurepasswd';

这对我使用 ActiveState Perl v5.4 和 mysql 8.0.17-winx64 很有效。

显然这是一种安全妥协,因为我们使用的是较旧的插件来比较密码?

关于mysql - 如何使用 perl 在 Windows V10 上访问 mysql V8?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57682296/

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