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

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

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.

Related

How to build DBD::mysql with DBI in a custom #INC?

I'm building DBI and DBD::mysql in a continuous integration build server. The build of DBI is successful, as seen in the excerpt of the build log below. It clearly installs DBI/DBD.pm in the correct location.
pushd DBI-1.643
perl Makefile.PL INSTALL_BASE=/data/pods/mysql-tools/mysql-tools/current
...
Installing /data/pods/mysql-tools/mysql-tools/current/lib/perl5/x86_64-linux-thread-multi/DBI/DBD.pm
...
Appending installation info to /data/pods/mysql-tools/mysql-tools/current/lib/perl5/x86_64-linux-thread-multi/perllocal.pod
But the next part of the build for DBD::mysql fails because it can't find the files installed by DBI.
pushd DBD-mysql-4.050
perl Makefile.PL INSTALL_BASE=/data/pods/mysql-tools/mysql-tools/current --ssl
Can't locate DBI/DBD.pm in #INC (#INC contains:
/usr/local/lib64/perl5
/usr/local/share/perl5
/usr/lib64/perl5/vendor_perl
/usr/share/perl5/vendor_perl
/usr/lib64/perl5
/usr/share/perl5 .)
at Makefile.PL line 15.
You can see, MakeMaker for DBD::mysql isn't adding the install location to its #INC at all. It just has default directories.
Is there a way to pass an argument to MakeMaker to add the install directory to #INC? I suppose I could hard-code it, but that seems improper and hard to maintain. Is there a better way to automatically add INSTALL_BASE/lib/perl5/<arch> to #INC?
Environment:
CentOS 7 Linux
Perl 5.16.3
I would have preferred to use cpanm of course. But the CI build server is isolated from the internet because of my employer's security policy. No http proxying is allowed from CI.
According to the documentation, INSTALL_BASE is used for telling make install where to put the installed module:
INSTALL_BASE
INSTALL_BASE can be passed into Makefile.PL to change where your
module will be installed. INSTALL_BASE is more like what everyone else
calls "prefix" than PREFIX is.
but it does not tell perl where to look for installed modules. To do that you can use the environment variable PERL5LIB, according to the documentation :
PERL5LIB
A list of directories in which to look for Perl library files before
looking in the standard library. Any architecture-specific and
version-specific directories, such as version/archname/, version/, or
archname/ under the specified locations are automatically included if
they exist, with this lookup done at interpreter startup time. In
addition, any directories matching the entries in
$Config{inc_version_list} are added.

Install GreenPAK Designer RPM

I am attempting to install closed source software from Silego, GreenPAK Designer, on a machine running Fedora 19. The supported installation packages on Silego's Website only target Ubuntu and Debian. I downloaded the .deb package and used Alien to convert to an RPM. So far so good, but a dry run of yum install showed dependency errors, which I solved by installing the necessary packages with yum:
qt5-qbase
qt5-qbase-gui
qt5-qtdeclarative
qt5-qtlocation
qwt
Now, yum installed the above libraries in /usr/lib/ but the GreenPAK RPM defaults to /usr/local/bin as the output dir. I figured I could run
sudo yum localinstall --nodeps --noscripts greenpak-designer-x.x.x.rpm
and get a successful install but I received conflict errors relating to dirs such as '/', '/usr', '/usr/bin' etc. I worked around this issue with:
rpmrebuild -pe --notest-install --replacefiles --noscripts greenpak-designer.x.x.x.rpm
and removing the offending lines in the script. It allowed me to install rpm but the software is broken because of dependency issues (not surprisingly). From the system log:
Jan 4 16:06:49 pelican gnome-session[1729]: /usr/local/greenpak-designer/bin/GP5: error while loading shared libraries: libicui18n.so.52: cannot open shared object file: No such file or directory
The machine has a /usr/lib/libicui18n.so.50
One thing I did not try is rebuilding my shared object cache with ldconfig, which sometimes solves problems with missing .so links when building from source but I don't see how that would apply in this instance (I'm not trying to link object files to libraries, rather simply trying to drop binaries in default install locations, no?)
Of course, I contacted the vendor and begged for an RPM. The contact was helpful but informed me the software folks are on a well deserved break. I thought I'd continue puttering with this in the meantime while I have time.
Any ideas? It seems the solution to this problem would be helpful when trying to install almost any closed source software targeting Debian on a Fedora box.

Compiling MySQL 5.7.20 in CentOS 7 Issues (A Lot)

I am trying to setup a MySQL server using CentOS (No GUI) and I need to switch to OpenSSL instead of YaSSL in order to have access to the encryption tools.
The issues happen when runing the cmake. At first I got the error that cmake was not able to find boost, I fixed this adding the parameter -DWITH_BOOST.
The cmake line is as follows.
cmake . -DWITH_READLINE=ON -DWITH_SSL=system -DWITH_BOOST=/usr/local/src/mysql-5.7.20/boost/
After the adjustment I ran again the CMAKE the I got several errors.
SSL Error, cmake can not find the OpenSSL files. I checked if the library was installed, I also downloaded the tar.gz file and decompress it and pointed the cmake to the folder, none of this worked.
Can not find NUMA libraries, again I checked and it is installed, at this point I ran the system update to check for everything but this did not solve the issue.
Can not find the ncurses, the same thing, is on the system but for some reason cmake is not able to find those.
Can not fin libaio, I didn't have this one installed, I installed, ran cmake again, and again cmake was not able to find it.
I been looking around, trying to figure out all this issues, I've been joining information from different websites but still not able to figure out this.
Thanks ahead to everyone for the help.
You're facing the dependencies hell with MySQL. If you don't really need to compile from the sources, you still can install with the RPM which is much easier. The RPM method is described here : https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/
As you're asking a ready-to-go install from the sources, this is what I just did and it worked, on a fresh CentOS 7.4 minimal, 2 vcpus 3Gb :
yum group install -y 'Development Tools'
yum install -y cmake ncurses-devel curl
curl -Ovk https://cdn.mysql.com/Downloads/MySQL-5.7/mysql-5.7.20.tar.gz
tar zxf mysql-5.7.20.tar.gz
cd mysql-5.7.20
cmake . -DDOWNLOAD_BOOST=1 -DWITH_BOOST=$HOME/boost -DENABLE_DOWNLOADS=1
make -j2
make install
After that you need to configure it, add the startup scripts, and of course secure it. Here are some additional docs :
http://howtolamp.com/lamp/mysql/5.6/installing/
https://dev.mysql.com/doc/refman/5.7/en/mysql-secure-installation.html
Perhaps try make clean; cmake clean; ldconfig then run your cmake command. Sometimes the system can't find the shared libraries, and ldconfig refreshes the library search path. This helped once when I was compiling something (emscripten?) which required a lot of libraries which I was installing as compilation errors arose.
The make clean; cmake clean will ensure that the compiler isn't looking at the old library search path when you recompile.

Creating riak nodes: bitcask version clash

I have installed riak on a Fedora 17 system (but not using the package manager) by following the standard instructions, i.e.:
$ wget http://downloads.basho.com.s3-website-us-east-1.amazonaws.com/riak/1.2/1.2.1/riak-1.2.1.tar.gz
$ tar zxvf riak-1.2.1.tar.gz
$ cd riak-1.2.1
$ make all
This worked and I now tried to create four nodes as described in the Fast Track tutorial:
$ make devrel
This runs for a while and then produces the error below:
==> rel (generate)
ERROR: generate failed while processing /space/surechem/riak-1.2.1/rel: {'EXIT',{{badmatch,{error,"bitcask: Application version clash. Multiple directories contains version \"1.5.2\"."}},
[{rebar_reltool,generate,2,[]},
{rebar_core,run_modules,4,[]},
{rebar_core,execute,4,[]},
{rebar_core,process_dir,4,[]},
{rebar_core,process_commands,2,[]},
{rebar,main,1,[]},
{escript,run,2,[{file,"escript.erl"},{line,741}]},
{escript,start,1,[{file,"escript.erl"},{line,277}]}]}}
make: *** [dev1] Error 1
I have difficulties understanding what that error message is trying to tell me.
Is this a version conflict with bitcask? The Fedora package erlang-bitcask is installed on the machine (erlang-bitcask-1.5.2-1.fc17.x86_64). Should it be removed? Do I need a different version of it?
Indeed this seems to be caused by conflicts with Erlang packages installed in the system. After removing the erlang-bitcask package from the system, I got similar error messages for other packages. In the end I had to remove four packages,
$ sudo yum remove erlang-bitcask erlang-ebloom erlang-js erlang-luke
to get it to work.

Perl and DBD::mysql Can't load mysql.so... Perhaps a required shared library or dll isn't installed where expected

Running this code on a shared host with a locally installed perl and modules which were installed via perlbrew. It worked fine for several weeks. One day, it started dying with this output:
/home/xxxx/perl5/perlbrew/perls/perl-5.16.2/bin/perl tweet.pl
install_driver(mysql) failed: Can't load '/home/xxxx/perl5/perlbrew/perls/perl-5.16.2/lib/site_perl/5.16.2/x86_64-linux/auto/DBD/mysql/mysql.so' for module DBD::mysql: libmysqlclient.so.15: cannot open shared object file: No such file or directory at /home/xxxx/perl5/perlbrew/perls/perl-5.16.2/lib/5.16.2/x86_64-linux/DynaLoader.pm line 190.
at (eval 27) line 3.
Compilation failed in require at (eval 27) line 3.
Perhaps a required shared library or dll isn't installed where expected
at subroutines.pm line 3.
The code hasn't changed. The way I run the script hasn't changed, either. Since I am running this one a shared host, I have no idea what might have been updated or changed on the server, but perl is installed to my home directory, as are all the modules I am using.
It looks like a problem with libmysqlclient. What distribution are you running?
If you are running Debian(based), try "sudo apt-get purge libmysqlclient libmysqlclient-dev" and then "sudo apt-get install libmysqlclient libmysqlclient-dev".