Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

cpanm mysql fails with errors

by vskatusa (Acolyte)
on May 24, 2020 at 20:44 UTC ( #11117206=perlquestion: print w/replies, xml ) Need Help??

vskatusa has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I have the following configuration:
  • ubuntu 16.04.6 LTS
  • perl 5, version 22
  • mysql Ver 14.14 Distrib 5.7.30
I tried to install mysql with the following command
cpanm DBD::mysql

And get FAIL Configure failed for DBD-mysql-4.050. See /root/.cpanm/work/1590352522.4014/build.log for details Here is the build.log

From the log it appears that it is not able to access mysql_config but I am not sure how to resolve this?

cpanm (App::cpanminus) 1.7044 on perl 5.022001 built for i686-linux-gn +u-thread-multi-64int Work directory is /root/.cpanm/work/1590352522.4014 You have make /usr/bin/make You have LWP 6.44 You have /bin/tar: tar (GNU tar) 1.28 Copyright (C) 2014 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gp +l.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by John Gilmore and Jay Fenlason. Searching DBD::mysql () on cpanmetadb ... --> Working on DBD::mysql Fetching http://www.cpan.org/authors/id/D/DV/DVEEDEN/DBD-mysql-4.050.t +ar.gz -> OK Unpacking DBD-mysql-4.050.tar.gz Entering DBD-mysql-4.050 Checking configure dependencies from META.json Checking if you have ExtUtils::MakeMaker 6.58 ... Yes (7.04_01) Checking if you have Data::Dumper 0 ... Yes (2.173) Checking if you have Devel::CheckLib 1.09 ... Yes (1.14) Checking if you have DBI 1.609 ... Yes (1.643) Configuring DBD-mysql-4.050 Running Makefile.PL Can't exec "mysql_config": No such file or directory at Makefile.PL li +ne 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": No such file or directory at Makefile.PL li +ne 603. 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 Can't find mysql_config. Use --mysql_config option to specify where my +sql_config is located -> N/A -> FAIL Configure failed for DBD-mysql-4.050. See /root/.cpanm/work/15 +90352522.4014/build.log for details.

Replies are listed 'Best First'.
Re: cpanm mysql fails with errors
by syphilis (Bishop) on May 25, 2020 at 00:04 UTC
Re: cpanm mysql fails with errors
by dsheroh (Monsignor) on May 25, 2020 at 06:55 UTC
    Although I generally prefer to install Perl modules from CPAN, I make an exception for DBI/DBD, because it tends to be a PITA to get all the pieces to line up just right, as you discovered. apt-get install libdbd-mysql (and/or libdbd-mariadb-perl) is so much quicker and easier, unless you have a specific reason for wanting to build it from source.
Re: cpanm mysql fails with errors
by haukex (Bishop) on May 26, 2020 at 07:14 UTC

    Try sudo apt-get build-dep libdbd-mysql-perl to get the packages you need to build DBD::mysql.

Re: cpanm mysql fails with errors
by perlfan (Vicar) on May 26, 2020 at 00:28 UTC
    >it is not able to access mysql_config but I am not sure how to resolve this?

    As the others said, install the mysql client package . Best answer below is to avoid all this is to install it via apt-get.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://11117206]
Approved by kcott
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2021-02-25 22:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?