您的位置:首页 > 数据库 > MySQL

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

2013-05-30 20:48 363 查看
安装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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: