install_driver(mysql) failed: Can't locate DBD/mysql.pm

…衆ロ難τιáo~ 提交于 2019-12-13 20:42:12

问题


Question is not repeated, first read the problem which I am facing, then mark it if it is repeated, will be helpful if repeatation of my question helps me in solving my problem, As I have been through all the links and solutions mentioned on other similar questions and problems but no luck.

I am trying to setup redmine git on my ec2-aws-instance with help of below link

https://docs.bitnami.com/installer/how-to/configure-advanced-integration-git-redmine/

I am able to properly connect redmine projects with my git repositories but once I reach third step on above link I am facing issue as below

step :- 3 Configure Git Access Control

Below is the error when try to secure my git repository with redmine user credentials.

[Thu Feb 21 17:46:26.918619 2019] [perl:error] [pid 26820:tid 139790464616192] [client 127.0.0.1:50156] install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (@INC contains: /opt/bitnami/git/lib/site_perl/5.16.3 /opt/bitnami/perl/lib/5.16.3/x86_64-linux-thread-multi /opt/bitnami/perl/lib/5.16.3 /opt/bitnami/perl/lib/site_perl/5.16.3/x86_64-linux-thread-multi /opt/bitnami/perl/lib/site_perl/5.16.3 /opt/bitnami/perl/lib/5.16.3/x86_64-linux-thread-multi /opt/bitnami/perl/lib/site_perl/5.16.3/x86_64-linux-thread-multi /bitnami/ruby23stack-linux-x64/output/perl/lib/site_perl/5.16.3/x86_64-linux-thread-multi /bitnami/ruby23stack-linux-x64/output/perl/lib/site_perl/5.16.3 /bitnami/ruby23stack-linux-x64/output/perl/lib/5.16.3/x86_64-linux-thread-multi /bitnami/ruby23stack-linux-x64/output/perl/lib/5.16.3 . /opt/bitnami/apache2) at (eval 6) line 3.\nPerhaps the DBD::mysql perl module hasn't been fully installed,\nor perhaps the capitalisation of 'mysql' isn't right.\nAvailable drivers: DBM, ExampleP, File, Gofer, Proxy, Sponge.\n at /opt/bitnami/perl/lib/site_perl/5.16.3/x86_64-linux-thread-multi/Apache/Redmine.pm line 557.\n App 26921 stdout:

Without third step my repositories are public, any who knows the repo url can clone my repos or perform other operations on my git repos. So third step is for security purpose as per above document link and which is important for me.

Once I add below line into apache config as per documentation mentioned I am getting above error in my bitnami log when I try to clone a repository

 <Location "/">
       AuthType Basic
       AuthName "Redmine git repositories"
       Require valid-user

       PerlAccessHandler Apache::Authn::Redmine::access_handler
       PerlAuthenHandler Apache::Authn::Redmine::authen_handler
       RedmineDSN "DBI:mysql:database=bitnami_redmine;host=localhost;mysql_socket=installdir/mysql/tmp/mysql.sock"
       RedmineDbUser "REDMINE_DB_USERNAME"
       RedmineDbPass "REDMINE_DB_PASSWORD"
       RedmineGitSmartHttp yes
     </Location>

When I run a following command to clone a repo, without third step on documentation, I am properly able to clone the repo, but with third step I am failing and getting above error in log and below error on command line.

bitnami@127.0.0.1:/tmp$ git clone http://git.domain.com/test2
Cloning into 'test2'...
fatal: unable to access 'http://git.domain.com/test2/': The requested URL returned error: 500

I have even tried installing below package but no luck

sudo apt-get install libdbd-mysql-perl

my os is

Ubuntu 16.04.5 LTS \n \l

回答1:


In order for a Perl installation to talk to a MySQL database, it needs to use the DBD::mysql module. This module isn't part of the standard Perl installation and needs to be installed separately. When you install it using the CPAN command line tool (cpan DBD::mysql) or using apt-get (apt-get install libdbd-mysql-perl) it is installed in the library directories used by the system Perl (the one that is installed as part of your operating system). You can confirm that this has been installed correctly by running the following commands:

$ perldoc DBD::mysql
$ perl -MDBD::mysql -le'print $DBD::mysql::VERSION'

If DBD::mysql is installed correctly, the first command will show you the documentation for the module and the second will give the version number.

But, as I said, this is installed for use by the system Perl installation. It appears from the error message you're seeing that your Bitnami installation isn't using the system Perl. It is, instead, using a separate Perl installation which is installed in /opt/bitnami.

So you need to get DBD::mysql installed in the module library for this Perl installation. It's possible to ask cpan to install a module in a different directory, but I'd be wary about just installing stuff into Bitnami's directory tree. I strongly suspect that an installation step has been skipped far earlier in the process. If Bitnami needs to use MySQL from a Perl program and installs its own Perl distribution complete with its own module library, then it should either include DBD::mysql in its installation or provide clear instructions on how to install it.

My suggestion would be to carefully go over the installation instructions for Bitnami and see what they have to say about installing MySQL support. If that doesn't work, you should take this question to Bitnami's support channels.



来源:https://stackoverflow.com/questions/54813743/install-drivermysql-failed-cant-locate-dbd-mysql-pm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!