Я установил последнюю версию базы данных mysql на свой ноутбук ubuntu 20.04.
Затем я попытался установить все модули Perl, которые мне нужны для написания сценариев Perl для доступа к моей базе данных mysql. Я запустил "sudo -i "сеанс, из которого я запустил команду" cpanb "
, я успешно использовал cpan для установки модуля DBI
Однако, когда я попытался установить модуль DBD :: mysql, это не удалось.
Последняя часть вывод был следующим:
Configuring D/DV/DVEEDEN/DBD-mysql-4.050.tar.gz with Makefile.PL
Can't exec "mysql_config": No such file or directory 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": No such file or directory 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.050.tar.gz
/usr/bin/perl Makefile.PL INSTALLDIRS=site -- NOT OK
Failed during this command:
DVEEDEN/DBD-mysql-4.050.tar.gz : writemakefile NO '/usr/bin/perl Makefile.PL INSTALLDIRS=site' returned status 512
cpan[3]>
После некоторого поиска в Google выяснилось, что для решения этой проблемы мне нужно было сделать следующее
sudo apt-get install libmysqlclient-dev
Теперь мои скрипты mysql на основе Perl работают нормально.