安装perl和DBI-mysql出现的一些问题

安装perl后, 因为想要运行innotop,mytop之类的perl文件。 所以出现了一系列问题:

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

原因:perl包没有安装完全。

解决办法:

.pm实际上是Perl的包,只需安装如下软件包即可:
yum install perl-Time-HiRes
2. failed: Can't locate DBD/mysql.pm in
原因1: 可能是perl-DBD-MySQL没安装。
yum install perl-DBD-MySQL
虽然我用yum安装了perl-DBD-MySQL, 但是还是不不成功。 依然是报这个错误。
问题没有解决。
原因2: DBD-mysql没有安装,下载DBD-mysql
解压:tar xzvf DBD-mysql**.tar.gz
进入该目录:cd DBD-mysql*
下面的要注意了:
perl Makefile.PL --mysql_config=/usr/lib64/mysql/mysql_config
如果不在lib64目录下的话, 请find下它。
接下来是更蛋疼的事情-----make。
make
结果出现了:
dbdimp.c:4650: error: 'imp_dbh_t' has no member named 'async_query_in_flight'
dbdimp.c:4693: error: 'imp_sth_t' has no member named 'params'
dbdimp.c:4693: warning: passing argument 1 of 'bind_param' from incompatible pointer type
dbdimp.c:798: note: expected 'struct imp_sth_ph_t *' but argument is of type 'const struct sql_type_info_
dbdimp.c: In function 'mysql_db_reconnect':
dbdimp.c:4839: error: 'MYSQL' undeclared (first use in this function)
dbdimp.c:4839: error: expected ';' before 'save_socket'
dbdimp.c:4849: error: 'imp_dbh_t' has no member named 'pmysql'
dbdimp.c:4849: error: 'CR_SERVER_GONE_ERROR' undeclared (first use in this function)
dbdimp.c:4849: warning: comparison between pointer and integer
dbdimp.c:4853: error: 'imp_dbh_t' has no member named 'auto_reconnect'
dbdimp.c:4867: error: 'save_socket' undeclared (first use in this function)
dbdimp.c:4867: error: 'imp_dbh_t' has no member named 'pmysql'
dbdimp.c:4868: error: 'imp_dbh_t' has no member named 'pmysql'
dbdimp.c:4868: warning: passing argument 3 of 'memcpy' makes integer from pointer without a cast
/usr/include/bits/string3.h:49: note: expected 'size_t' but argument is of type 'const struct sql_type_in
dbdimp.c:4869: error: 'imp_dbh_t' has no member named 'pmysql'
dbdimp.c:4869: error: 'imp_dbh_t' has no member named 'pmysql'
dbdimp.c:4869: warning: passing argument 1 of 'memset' discards qualifiers from pointer target type
/usr/include/bits/string3.h:77: note: expected 'void *' but argument is of type 'const struct sql_type_in
dbdimp.c:4877: error: 'imp_dbh_t' has no member named 'pmysql'
dbdimp.c:4877: error: 'imp_dbh_t' has no member named 'pmysql'
dbdimp.c:4878: warning: passing argument 3 of 'mysql_dr_error' makes pointer from integer without a cast
dbdimp.c:1429: note: expected 'const char *' but argument is of type 'int'
dbdimp.c:4879: error: 'imp_dbh_t' has no member named 'pmysql'
dbdimp.c:4879: warning: passing argument 1 of 'memcpy' discards qualifiers from pointer target type
/usr/include/bits/string3.h:49: note: expected 'void * __restrict__' but argument is of type 'const struc
dbdimp.c:4879: warning: passing argument 3 of 'memcpy' makes integer from pointer without a cast
/usr/include/bits/string3.h:49: note: expected 'size_t' but argument is of type 'const struct sql_type_in
dbdimp.c:4880: error: 'imp_dbh_t' has no member named 'stats'
dbdimp.c:4880: error: request for member 'auto_reconnects_failed' in something not a structure or union
dbdimp.c:4880: error: lvalue required as increment operand
dbdimp.c:4889: error: 'imp_dbh_t' has no member named 'stats'
在dbdimp.c里面出现了一系列的错误。
我查找了/usr/include, 结果发现没有mysql相关的头文件。 哎, 赶紧装相关的头文件吧。

方法一: 编译mysql源码安装mysql。
请参考 编译安装mysql

方法二: yum 安装mysql-devel (我当然推荐这种方法啦)
yum install mysql-devel
查看/usr/include目录, 有了/usr/include/mysql文件夹。

接下来正常进行:
make
make test
make install
发现问题解决了。


参考网站有:
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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值