安裝PERL cpan DBD::mysql錯誤筆記

來源:互聯網
上載者:User

開始使用:cpan DBD::mysql 命令來安裝該模組
由於是編譯的版本的SQL版本,已經在/etc/profile 中修改:export PATH=/usr/local/mysql/bin:$PATH
擔心找不到mysql lib檔案。

報錯如下:
# Tried to use 'DBD::mysql'.
# Error: Can't load '/root/.cpan/build/DBD-mysql-4.022/blib/arch/auto/DBD/mysql/mysql.so' for module DBD::mysql: libmysqlclient.so.16: 無法開啟共用對象檔案: 沒有那個檔案或目錄 at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/DynaLoader.pm line 230.
# at (eval 6) line 2
# Compilation failed in require at (eval 6) line 2.
# BEGIN failed--compilation aborted at t/00base.t line 21.
FAILED--Further testing stopped: Unable to load DBD::mysql
make: *** [test_dynamic] 錯誤 9
/usr/bin/make test -- NOT OK
Running make install
make test had returned bad status, won't install without force
[root@localhost dbdata_backup]# perl -MCPAN -e shell
Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v1.7602)
ReadLine support available (try 'install Bundle::CPAN')

解決方式:
shell>perl -MCPAN -e shell
cpan> install DBI
cpan> install DBD::mysql安裝成功。

手工安裝DBD安裝技巧:
注意mysql的環境變數,若沒有則用 添加/usr/local/mysql/bin到環境變數PATH中
PATH=/usr/local/mysql/bin:$PATH;
export PATH (mysql的安裝路徑根據實際情況填寫)
wget http://cpan.perl.org/modules/by-module/DBI/DBI-1.601.tar.gz
tar -zxvf DBD-mysql-4.006.tar.gz
cd DBD-mysql-4.006
perl Makefile.PL –mysql_config=/usr/local/mysql/bin/mysql_config
make
make test
make install

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.