尝试安装 Perl-Mysql DBD,找不到 mysql_config
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4729722/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Trying to install Perl-Mysql DBD, mysql_config can't be found
提问by ian
Here's the output:
这是输出:
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
I've researched the issue and tried making a symlink to no avail.
我研究了这个问题并尝试制作符号链接无济于事。
Do I have to compile this myself?
我必须自己编译吗?
回答by 99Sono
If you installed the mysql server that everybody installs: sudo apt-get install mysql-server (or something like this)
如果您安装了每个人都安装的 mysql 服务器: sudo apt-get install mysql-server (或类似的东西)
you are missing a few extra files on which the makefile for this perl module depends.
你缺少一些额外的文件,这个 perl 模块的 makefile 依赖于这些文件。
You can try to work around this issue by installing the following package:
您可以尝试通过安装以下软件包来解决此问题:
sudo apt-get install libmysqlclient-dev
REFERECE: http://cpansearch.perl.org/src/RUDY/DBD-mysql-2.9008/INSTALL.html#configuration
参考:http://cpansearch.perl.org/src/RUDY/DBD-mysql-2.9008/INSTALL.html#configuration
回答by Damian Green
Applying to ubuntu/debian users (I'm running U-12.0.4), it was suggested above that users do:
适用于 ubuntu/debian 用户(我运行的是 U-12.0.4),上面建议用户这样做:
sudo apt-get install libmysqlclient-dev
But then there is another problem with the maketest portion of the install where the "password: NO" FAILED. To bypass that test, just use force:
但是,安装的 maketest 部分存在另一个问题,其中“密码:否”失败。要绕过该测试,只需使用 force:
sudo cpan -f DBD::mysql
回答by made_in_india
if u r using ubuntu , u can easily install using the below cmd
如果您使用 ubuntu ,您可以使用以下内容轻松安装 cmd
sudo apt-get install libdbd-mysql-perl
for more detail check the cpan install.podconsist detail about other Linux flavor
有关更多详细信息,请检查 cpan install.pod包含有关其他 Linux 风格的详细信息
回答by AaronC
Install the mysql-devel package that pertains to your distro and mysql server version.
安装与您的发行版和 mysql 服务器版本相关的 mysql-devel 包。
回答by Hyman
You just need mysql-server and mysql-devel installed locally so that cpan can build the module, you can probably remove the mysql server afterwards.
您只需要在本地安装 mysql-server 和 mysql-devel 以便 cpan 可以构建模块,之后您可能可以删除 mysql 服务器。
回答by mob
Find the script mysql_config.pl
under your MySQL directory, and run Makefile.PL
like:
mysql_config.pl
在你的 MySQL 目录下找到脚本,然后运行Makefile.PL
:
perl Makefile.PL --mysql_config=/path/to/mysql-5.x.y.zzz/bin/mysql_config.pl
回答by JohnH
If you try to install via CPAN you cannot, as far as I know, set the --mysql_config
option directly. And, including the directory containing mysql_config in the PATH environment variable does not seem to help.
如果您尝试通过 CPAN 安装,据我所知,您不能--mysql_config
直接设置该选项。而且,在 PATH 环境变量中包含包含 mysql_config 的目录似乎没有帮助。
However, if you do have the file mysql_config available somewhere, you can do the following to make the install succeed:
但是,如果您确实在某处有可用的文件 mysql_config,则可以执行以下操作以使安装成功:
ln -s /path/to/mysql_config /usr/local/bin/
Then, remove the symbolic link after the DBD::mysql installation.
然后,在安装 DBD::mysql 后删除符号链接。
The tests during install will still fail, unless you have installed MySQL in some central/default location on your system, but installation will still succeed.
安装期间的测试仍然会失败,除非您已经在系统的某个中央/默认位置安装了 MySQL,但安装仍然会成功。
If you do not have mysql_config available, you can get it from a tar.gz download of the MySQL Community Server from mysql.com. It will be located in the bin/ subdirectory of the extracted files. If you want to have MySQL installed on your system, a better option is probably to download the RPMs and install them, or install via the package management system of your OS.
如果您没有可用的 mysql_config,您可以从mysql.com的 MySQL 社区服务器的 tar.gz 下载中获取它。它将位于解压缩文件的 bin/ 子目录中。如果你想在你的系统上安装 MySQL,一个更好的选择可能是下载 RPMs 并安装它们,或者通过你的操作系统的包管理系统安装。
回答by Eranga Atugoda
Try yum install mariadb-devel
for CentOS 7 and then
run the required Perl module installation such as cpan DBD::mysql
尝试yum install mariadb-devel
使用 CentOS 7,然后运行所需的 Perl 模块安装,例如cpan DBD::mysql
回答by PodTech.io
I was getting make test errors. This helped me;
我遇到了 make test 错误。这对我有帮助;
perl Makefile.PL --testuser=bob --testpass=bobtest