安裝perl和DBI-mysql出現的一些問題

原網址 http://blog.csdn.net/nemo2011/article/details/8996415

安裝perl後, 因爲想要運行innotop,mytop之類的perl文件。 所以出現了一系列問題:

1. Can't locate Time/HiRes.pm in

原因:perl包沒有安裝完全。

解決辦法:

.pm實際上是Perl的包,只需安裝如下軟件包即可:

[cpp] view plaincopy

  1. <span style="font-size:14px;">yum install perl-Time-HiRes</span>  

2. failed: Can't locate DBD/mysql.pm in
原因1: 可能是perl-DBD-MySQL沒安裝。

[cpp] view plaincopy

  1. <span style="font-size:14px;">yum install perl-DBD-MySQL</span>  

雖然我用yum安裝了perl-DBD-MySQL, 但是還是不不成功。 依然是報這個錯誤。
問題沒有解決。
原因2: DBD-mysql沒有安裝,下載DBD-mysql

[cpp] view plaincopy

  1. <span style="font-size:14px;">解壓:tar xzvf DBD-mysql**.tar.gz  

  2. 進入該目錄:cd DBD-mysql*  

  3. </span>  

下面的要注意了:

[cpp] view plaincopy

  1. <span style="font-size:14px;">perl Makefile.PL --mysql_config=/usr/lib64/mysql/mysql_config</span>  

如果不在lib64目錄下的話, 請find下它。
接下來是更蛋疼的事情-----make。

[cpp] view plaincopy

  1. <span style="font-size:14px;">make</span>  

結果出現了:

[cpp] view plaincopy

  1. <span style="font-size:14px;">dbdimp.c:4650: error: 'imp_dbh_t' has no member named 'async_query_in_flight'  

  2. dbdimp.c:4693: error: 'imp_sth_t' has no member named 'params'  

  3. dbdimp.c:4693: warning: passing argument 1 of 'bind_param' from incompatible pointer type  

  4. dbdimp.c:798: note: expected 'struct imp_sth_ph_t *' but argument is of type 'const struct sql_type_info_  

  5. dbdimp.c: In function 'mysql_db_reconnect':  

  6. dbdimp.c:4839: error: 'MYSQL' undeclared (first use in this function)  

  7. dbdimp.c:4839: error: expected ';' before 'save_socket'  

  8. dbdimp.c:4849: error: 'imp_dbh_t' has no member named 'pmysql'  

  9. dbdimp.c:4849: error: 'CR_SERVER_GONE_ERROR' undeclared (first use in this function)  

  10. dbdimp.c:4849: warning: comparison between pointer and integer  

  11. dbdimp.c:4853: error: 'imp_dbh_t' has no member named 'auto_reconnect'  

  12. dbdimp.c:4867: error: 'save_socket' undeclared (first use in this function)  

  13. dbdimp.c:4867: error: 'imp_dbh_t' has no member named 'pmysql'  

  14. dbdimp.c:4868: error: 'imp_dbh_t' has no member named 'pmysql'  

  15. dbdimp.c:4868: warning: passing argument 3 of 'memcpy' makes integer from pointer without a cast  

  16. /usr/include/bits/string3.h:49: note: expected 'size_t' but argument is of type 'const struct sql_type_in  

  17. dbdimp.c:4869: error: 'imp_dbh_t' has no member named 'pmysql'  

  18. dbdimp.c:4869: error: 'imp_dbh_t' has no member named 'pmysql'  

  19. dbdimp.c:4869: warning: passing argument 1 of 'memset' discards qualifiers from pointer target type  

  20. /usr/include/bits/string3.h:77: note: expected 'void *' but argument is of type 'const struct sql_type_in  

  21. dbdimp.c:4877: error: 'imp_dbh_t' has no member named 'pmysql'  

  22. dbdimp.c:4877: error: 'imp_dbh_t' has no member named 'pmysql'  

  23. dbdimp.c:4878: warning: passing argument 3 of 'mysql_dr_error' makes pointer from integer without a cast  

  24. dbdimp.c:1429: note: expected 'const char *' but argument is of type 'int'  

  25. dbdimp.c:4879: error: 'imp_dbh_t' has no member named 'pmysql'  

  26. dbdimp.c:4879: warning: passing argument 1 of 'memcpy' discards qualifiers from pointer target type  

  27. /usr/include/bits/string3.h:49: note: expected 'void * __restrict__' but argument is of type 'const struc  

  28. dbdimp.c:4879: warning: passing argument 3 of 'memcpy' makes integer from pointer without a cast  

  29. /usr/include/bits/string3.h:49: note: expected 'size_t' but argument is of type 'const struct sql_type_in  

  30. dbdimp.c:4880: error: 'imp_dbh_t' has no member named 'stats'  

  31. dbdimp.c:4880: error: request for member 'auto_reconnects_failed' in something not a structure or union  

  32. dbdimp.c:4880: error: lvalue required as increment operand  

  33. dbdimp.c:4889: error: 'imp_dbh_t' has no member named 'stats'  

  34. </span>  

在dbdimp.c裏面出現了一系列的錯誤。
我查找了/usr/include, 結果發現沒有mysql相關的頭文件。 哎, 趕緊裝相關的頭文件吧。

方法一: 編譯mysql源碼安裝mysql。
請參考 編譯安裝mysql

方法二: yum 安裝mysql-devel (我當然推薦這種方法啦)

[cpp] view plaincopy

  1. <span style="font-size:14px;">yum install mysql-devel</span>  

查看/usr/include目錄, 有了/usr/include/mysql文件夾。

接下來正常進行:

[cpp] view plaincopy

  1. <span style="font-size:14px;">make  

  2. make test  

  3. make install</span>  

發現問題解決了。


參考網站有:
http://bbs.linuxtone.org/thread-9283-1-1.html
http://www.myexception.cn/database/1242750.html
http://blog.sina.com.cn/s/blog_bd84f64e01015nxc.html
http://blog.chinaunix.net/uid-25530360-id-3413319.html


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章