0

I'm running an Amazon EC2 instance (uname -r gives "3.4.43-43.43.amzn1.x86_64") and trying to set up DBD::mysql for use with my Perl scripts.

Installing DBD::mysql with cpanm: cpanm --sudo DBD::mysql

This returns an error with the following log file:

You have /usr/bin/unzip Searching DBD::mysql on cpanmetadb ...
--> Working on DBD::mysql Fetching http://www.cpan.org/authors/id/C/CA/CAPTTOFU/DBD-mysql-4.023.tar.gz
-> OK Unpacking DBD-mysql-4.023.tar.gz Entering DBD-mysql-4.023 Checking configure dependencies from META.yml Checking if you have DBI
1.08 ... Yes (1.627) Configuring DBD-mysql-4.023 Running Makefile.PL 64 lines yanked                                               1,1      Top

perl Makefile.PL --testuser=username

Can't exec "mysql_config": No such file or directory at Makefile.PL line 479. 
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 479. 
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 479. Failed to determine directory of mysql.h. Use

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

to set this directory. For details see the INSTALL.html file, section "C Compiler flags" or type

  perl Makefile.PL --help Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located
-> N/A
-> FAIL Configure failed for DBD-mysql-4.023. See /home/ec2-user/.cpanm/work/1373404386.28268/build.log for details.

I've tried searching for mysql_config on the entire system and found nothing. I've googled for hours and haven't found a solution. Any help is much appreciated! Thanks

jwarwani
  • 201
  • 3
  • 6

3 Answers3

7

In ubuntu just install libmysqlclient-dev via

sudo apt-get install libmysqlclient-dev
AmirM
  • 71
  • 1
  • 2
0

Here's the relevant documentation from the INSTALL.html for the archive you downloaded:

The DBD::mysql Makefile.PL needs to know where to find your MySQL installation. This may be achieved using command line switches (see Configuration) or automatically using the mysql_config binary which comes with most MySQL distributions. If your MySQL distribution contains mysql_config the easiest method is to ensure this binary is on your path.

So, you should already have that file (and MySQL installed) before running this command apparently. If you don't have the file with your distribution of MySQL, then you may have to use the command line switches instead...

So, what version of MySQL did you install prior? Or should you be using Amazon RDS in this case?

  • 2
    to clarify, the mysql client libraries and their development interface need to be installed, not the mysql server. in the debian world, this is the libmysqlclient-dev package – ysth Jul 10 '13 at 15:12
  • I have the 5.5 mysql installed. As for libmysqlclient-dev package, I believe the equivalent for the EC2 is mysql-devel, which I have installed. I did a search for mysql packages on yum using yum list \*mysql\* One of the packages was called perl-dbd-mysql. I installed it and it might have solved my problem. I will update the post later if it has. – jwarwani Jul 10 '13 at 15:32
  • @jwarwani hmm just saw a related question: http://stackoverflow.com/questions/7475223/mysql-config-not-found-when-installing-mysqldb-python-interface Did you install from source? –  Jul 10 '13 at 15:43
  • Yes I did. Installing the perl-dbd-mysql package solved my problem =D I can't post that as my own solution yet (I just created this account and have to wait 8 hours before I can answer my own question; website rules). I'll post it when i'm able to. – jwarwani Jul 10 '13 at 18:52
0

I did a search for mysql packages on yum using yum list \*mysql\* One of the packages was called perl-dbd-mysql. I installed it and it seems to have done the trick.

jwarwani
  • 201
  • 3
  • 6
  • Where is the module installed, I tried this and Package perl-DBD-MySQL-4.023-6.el7.x86_64 already installed and latest version, but perldoc DBD::mysql No documentation found for "DBD::mysql". – Kemin Zhou Oct 21 '18 at 17:56