0

我正在运行一个 Amazon EC2 实例(uname -r 给出“3.4.43-43.43.amzn1.x86_64”)并尝试设置 DBD::mysql 以与我的 Perl 脚本一起使用。

使用 cpanm 安装 DBD::mysql:cpanm --sudo DBD::mysql

这将返回带有以下日志文​​件的错误:

You have /usr/bin/unzip Searching DBD::mysql on cpanmetadb ...
--> Working on DBD::mysql Fetching http://www.cpan.org/authors/id/C/CA/CAPTTOFU/DBD-mysql-4.023.tar.gz
-> OK Unpacking DBD-mysql-4.023.tar.gz Entering DBD-mysql-4.023 Checking configure dependencies from META.yml Checking if you have DBI
1.08 ... Yes (1.627) Configuring DBD-mysql-4.023 Running Makefile.PL 64 lines yanked                                               1,1      Top

perl Makefile.PL --testuser=username

Can't exec "mysql_config": No such file or directory at Makefile.PL line 479. 
Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located 
Can't exec "mysql_config": No such file or directory at Makefile.PL line 479. 
Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located 
Can't exec "mysql_config": No such file or directory at Makefile.PL line 479. Failed to determine directory of mysql.h. Use

  perl Makefile.PL --cflags=-I<dir>

to set this directory. For details see the INSTALL.html file, section "C Compiler flags" or type

  perl Makefile.PL --help Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located
-> N/A
-> FAIL Configure failed for DBD-mysql-4.023. See /home/ec2-user/.cpanm/work/1373404386.28268/build.log for details.

我尝试在整个系统上搜索 mysql_config 并没有找到任何结果。我已经用谷歌搜索了几个小时,但没有找到解决方案。任何帮助深表感谢!谢谢

4

3 回答 3

7

在 ubuntu 中,只需通过以下方式安装libmysqlclient-dev

sudo apt-get install libmysqlclient-dev
于 2014-08-06T16:46:40.017 回答
0

这是您下载的档案的 INSTALL.html 中的相关文档:

DBD::mysql Makefile.PL 需要知道在哪里可以找到您的 MySQL 安装。这可以使用命令行开关(参见配置)或自动使用大多数 MySQL 发行版附带的 mysql_config 二进制文件来实现。如果您的 MySQL 发行版包含 mysql_config,最简单的方法是确保此二进制文件在您的路径上。

因此,在运行此命令之前,您应该已经拥有该文件(并安装了 MySQL)。如果您的 MySQL 发行版中没有该文件,那么您可能必须改用命令行开关...

那么,您之前安装了哪个版本的 MySQL?还是在这种情况下您应该使用 Amazon RDS?

于 2013-07-10T14:59:25.277 回答
0

我在 yum 上搜索了 mysql 包,yum list \*mysql\* 其中一个包名为 perl-dbd-mysql。我安装了它,它似乎已经成功了。

于 2013-07-11T15:32:59.397 回答