2013-07-10 94 views
0

我正在運行Amazon EC2實例(uname -r給出「3.4.43-43.43.amzn1.x86_64」)並嘗試設置DBD :: mysql用於我的Perl腳本。在Amazon EC2上安裝DBD :: mysql時無法找到mysql_config

安裝DBD :: mysql的與cpanm: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和一無所獲。我搜索了幾個小時並沒有找到解決方案。任何幫助深表感謝!由於

+0

其Linux發行版? – ysth

回答

0

我在yum上搜索了mysql包,使用yum list \*mysql\* 其中一個包叫做perl-dbd-mysql。我安裝它,它似乎已經完成了。

0

下面是從該的Install.html相關文件存檔您下載:

的DBD :: mysql的Makefile.PL需要知道在哪裏可以找到你的MySQL安裝 。這可以通過使用命令行開關(請參閱 配置)或使用mysql_config二進制文件實現,該二進制文件與大多數MySQL發行版一起提供。如果你的MySQL發行版 包含mysql_config,最簡單的方法是確保你的路徑上的這個二進制文件是 。

因此,在運行此命令之前,您應該已經擁有該文件(並安裝了MySQL)。如果你的MySQL沒有這個文件,那麼你可能不得不使用命令行開關來代替...

那麼,你之前安裝了哪個版本的MySQL?或者你應該在這種情況下使用Amazon RDS?

+2

爲了澄清,mysql客戶端庫及其開發接口需要安裝,而不是mysql服務器。在Debian世界中,這是libmysqlclient-dev包 – ysth

+0

我安裝了5.5 mysql。 至於lib​​mysqlclient-dev包,我相信EC2的等價物是我已經安裝的mysql-devel。 我使用yum list \ * mysql \ * 在yum上搜索了mysql軟件包,其中一個軟件包名爲perl-dbd-mysql。我安裝了它,它可能解決了我的問題。如果有更新,我會稍後更新。 – jwarwani

+0

@ jwarwani嗯剛剛看到一個相關的問題:http://stackoverflow.com/questions/7475223/mysql-config-not-found-when-installing-mysqldb-python-interface你從源代碼安裝? – 2013-07-10 15:43:54

6

在Ubuntu只需安裝的libmysqlclient-dev的通過

sudo apt-get install libmysqlclient-dev