Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying to install Perl-Mysql DBD, mysql_config can't be found

Here's the output:

Ian-MacBook-Pro:DBD-mysql-4.011 ianseyer$ sudo Perl Makefile.PL Can't exec "mysql_config": No such file or directory at Makefile.PL line 76.  Cannot find the file 'mysql_config'! Your execution PATH doesn't seem  not contain the path to mysql_config. Resorting to guessed values! Can't exec "mysql_config": No such file or directory at Makefile.PL line 454. Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located Can't exec "mysql_config": No such file or directory at Makefile.PL line 454. Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located Can't exec "mysql_config": No such file or directory at Makefile.PL line 454. Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located   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": No such file or directory at Makefile.PL line 454. Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located Can't exec "mysql_config": No such file or directory at Makefile.PL line 454. Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located Can't exec "mysql_config": No such file or directory at Makefile.PL line 454. 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  to set this directory. For details see the INSTALL.html file, section "C Compiler flags" or type    perl Makefile.PL --help 

I've researched the issue and tried making a symlink to no avail.

Do I have to compile this myself?

like image 801
ian Avatar asked Jan 18 '11 22:01

ian


2 Answers

If you installed the mysql server that everybody installs: sudo apt-get install mysql-server (or something like this)

you are missing a few extra files on which the makefile for this perl module depends.

You can try to work around this issue by installing the following package:

sudo apt-get install libmysqlclient-dev  

REFERECE: http://cpansearch.perl.org/src/RUDY/DBD-mysql-2.9008/INSTALL.html#configuration

like image 68
99Sono Avatar answered Sep 29 '22 20:09

99Sono


Applying to ubuntu/debian users (I'm running U-12.0.4), it was suggested above that users do:

sudo apt-get install libmysqlclient-dev 

But then there is another problem with the maketest portion of the install where the "password: NO" FAILED. To bypass that test, just use force:

sudo cpan -f DBD::mysql 
like image 24
Damian Green Avatar answered Sep 29 '22 20:09

Damian Green