The Perl DBI模块提供了一个通用的数据库访问接口。你可以编写一个DBI脚本,它可以在许多不同的数据库引擎上运行而无需更改。要使用DBI,你必须安装DBI模块,以及针对你想访问的每种类型的数据库服务器的数据库驱动(DBD)模块。对于 MySQL,这个驱动是DBD::mysql模块。The Perl DBI module provides a generic interface
for database access. You can write a DBI script
that works with many different database engines without change. To
use DBI, you must install the
DBI module, as well as a DataBase Driver (DBD)
module for each type of database server you want to access. For
MySQL, this driver is the DBD::mysql module.
MySQL 发行版中不包含 Perl 支持。对于 Unix,您可以从 http://search.cpan.org 获取必要的模块,或者在 Windows 上使用 ActiveState ppm 程序。以下各节介绍了如何执行此操作。Perl support is not included with MySQL distributions. You can obtain the necessary modules from http://search.cpan.org for Unix, or by using the ActiveState ppm program on Windows. The following sections describe how to do this.
DBI/DBD 接口需要 Perl 5.6.0,首选 5.6.1 或更高版本。如果您使用旧版本的 Perl,则 DBI 无法工作。您应该使用 DBD::mysql 4.009 或更高版本。尽管有早期版本,但它们不支持 MySQL 8.4 的全部功能。The DBI/DBD interface requires
Perl 5.6.0, and 5.6.1 or later is preferred. DBI does not
work if you have an older version of Perl. You should use
DBD::mysql 4.009 or higher. Although earlier
versions are available, they do not support the full functionality
of MySQL 8.4.