请教安装DBD::mysql碰到的问题

Web、Mail、Ftp、DNS、Proxy、VPN、Samba、LDAP 等基础网络服务
回复
shawrain
帖子: 51
注册时间: 2015-11-13 16:30
系统: ubuntu15.04

请教安装DBD::mysql碰到的问题

#1

帖子 shawrain » 2018-11-18 18:34

各位大侠,请教个问题:
运行软件时报错:Can't locate DBD/mysql.pm in @INC (you may need to install the DBD::mysql module)

进入CPAN安装时也报错了:
cpan[1]> install DBD::mysql
Reading '/root/.cpan/Metadata'
Database was generated on Sun, 18 Nov 2018 06:17:03 GMT
Running install for module 'DBD::mysql'
Checksum for /root/.cpan/sources/authors/id/D/DV/DVEEDEN/DBD-mysql-4.049.tar.gz ok
Scanning cache /root/.cpan/build for sizes
............................................................................DONE
'YAML' not installed, will not store persistent state
Configuring D/DV/DVEEDEN/DBD-mysql-4.049.tar.gz with Makefile.PL
Can't exec "mysql_config": 没有那个文件或目录 at Makefile.PL line 89.

Cannot find the file 'mysql_config'! Your execution PATH doesn't seem
not contain the path to mysql_config. Resorting to guessed values!


PLEASE NOTE:

For 'make test' to run properly, you must ensure that the
database user 'root' can connect to your MySQL server
and has the proper privileges that these tests require such
as 'drop table', 'create table', 'drop procedure', 'create procedure'
as well as others.

mysql> grant all privileges on test.* to 'root'@'localhost' identified by 's3kr1t';

You can also optionally set the user to run 'make test' with:

perl Makefile.PL --testuser=username

Can't exec "mysql_config": 没有那个文件或目录 at Makefile.PL line 603.
Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located
Failed to determine directory of mysql.h. Use

perl Makefile.PL --cflags=-I<dir>

to set this directory. For details see DBD::mysql::INSTALL,
section "C Compiler flags" or type

perl Makefile.PL --help
Warning: No success on command[/usr/bin/perl Makefile.PL INSTALLDIRS=site]
DVEEDEN/DBD-mysql-4.049.tar.gz
/usr/bin/perl Makefile.PL INSTALLDIRS=site -- NOT OK
Failed during this command:
DVEEDEN/DBD-mysql-4.049.tar.gz : writemakefile NO '/usr/bin/perl Makefile.PL INSTALLDIRS=site' returned status 512



是什么原因?怎么解决? :What
头像
astolia
论坛版主
帖子: 6396
注册时间: 2008-09-18 13:11

Re: 请教安装DBD::mysql碰到的问题

#2

帖子 astolia » 2018-11-18 21:03

你要装DBD::mysql,cpan要去下载它的源代码进行编译,但你系统上没有安装mysql的相关开发文件,导致mysql_config找不到没法编译

代码: 全选

sudo apt install libmysqlclient-dev
shawrain
帖子: 51
注册时间: 2015-11-13 16:30
系统: ubuntu15.04

Re: 请教安装DBD::mysql碰到的问题

#3

帖子 shawrain » 2018-11-19 20:50

astolia 写了: 2018-11-18 21:03 你要装DBD::mysql,cpan要去下载它的源代码进行编译,但你系统上没有安装mysql的相关开发文件,导致mysql_config找不到没法编译

代码: 全选

sudo apt install libmysqlclient-dev
成功解决了,谢谢
回复