试图安装Perl-Mysql DBD,无法找到mysql_config

ian*_*ian 27 mysql database perl

这是输出:

Ian-MacBook-Pro:DBD-mysql-4.011 ianseyer$ sudo Perl Makefile.PL
Can't exec "mysql_config": No such file or directory at Makefile.PL line 76.

Cannot find the file 'mysql_config'! Your execution PATH doesn't seem 
not contain the path to mysql_config. Resorting to guessed values!
Can't exec "mysql_config": No such file or directory at Makefile.PL line 454.
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 454.
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 454.
Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located


PLEASE NOTE:

For 'make test' to run properly, you must ensure that the 
database user 'root' can connect to your MySQL server 
and has the proper privileges that these tests require such 
as 'drop table', 'create table', 'drop procedure', 'create procedure'
as well as others. 

mysql> grant all privileges on test.* to 'root'@'localhost' identified by 's3kr1t';

You can also optionally set the user to run 'make test' with:

perl Makefile.pl --testuser=username

Can't exec "mysql_config": No such file or directory at Makefile.PL line 454.
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 454.
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 454.
Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located
Failed to determine directory of mysql.h. Use

  perl Makefile.PL --cflags=-I

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

  perl Makefile.PL --help

我已经研究过这个问题并尝试使用符号链接无济于事.

我必须自己编译吗?

99S*_*ono 40

如果您安装了每个人都安装的mysql服务器:sudo apt-get install mysql-server(或类似的东西)

你缺少一些额外的文件,这个perl模块的makefile依赖于这些文件.

您可以尝试通过安装以下程序包来解决此问题:

sudo apt-get install libmysqlclient-dev 
Run Code Online (Sandbox Code Playgroud)

REFERECE:http://cpansearch.perl.org/src/RUDY/DBD-mysql-2.9008/INSTALL.html#configuration

  • ...或者sudo apt-get install libmariadbd-dev (3认同)

Dam*_*een 15

应用于ubuntu/debian用户(我正在运行U-12.0.4),上面建议用户这样做:

sudo apt-get install libmysqlclient-dev
Run Code Online (Sandbox Code Playgroud)

但是,安装的maketest部分存在另一个问题,其中"密码:否"失败.要绕过该测试,只需使用force:

sudo cpan -f DBD::mysql
Run Code Online (Sandbox Code Playgroud)


mad*_*dia 8

如果你使用ubuntu,你可以使用下面的方便安装 cmd

    sudo apt-get install libdbd-mysql-perl
Run Code Online (Sandbox Code Playgroud)

有关更多详细信息,请查看cpan install.pod包含有关其他Linux风格的详细信息


小智 6

安装与您的发行版和mysql服务器版本相关的mysql-devel包.


mob*_*mob 4

mysql_config.pl在 MySQL 目录下找到脚本,然后运行Makefile.PL

perl Makefile.PL --mysql_config=/path/to/mysql-5.x.y.zzz/bin/mysql_config.pl
Run Code Online (Sandbox Code Playgroud)

  • 我不知道,也许去看电视吧。`DBD::mysql` 依赖于 MySQL 客户端库。 (8认同)
  • 如果你不想在本地机器上安装mysql,你该怎么办? (2认同)