Welcome Guest. Please Login or Register  

You are here: Index > AMPPS > General Support > Topic : Problems to connect to MySQL via Perl

Threaded Mode | Print  

 Problems to connect to MySQL via Perl, We get an error when we are trying to connect to a MySQL database (1 Replies, Read 2531 times)
Group: Member
Post Group: Newbie
Posts: 1

we have a problem to connect from a cgi file to a MySQL database.

(With AMPPS 3.2 on a MAC OS X 10.10.4 Yosemite)

Our small test script is the following:


#!/Applications/AMPPS/perl/bin/perl -w

use strict;
use DBI;
use CGI::Carp qw(fatalsToBrowser);
use Digest::MD5 qw(md5_hex);
use CGI;

my $query=new CGI ;

my $dbh=DBNEW();
$dbh->disconnect ();

sub DBNEW 
    my $dsn = "DBI:mysql:database-name:database-host";
    my $dbh="";

    # Connect
    unless ( $dbh = DBI -> connect ("$dsn", "db-user", "dbpass" , {RaiseError=>1,PrintError=>0} ) ) {
        die "no connect: $DBI::errstr";   
    return ( $dbh );

And when we start this script in a browser, we get the following error notice:


Software error:

install_driver(mysql) failed: Can't load '/Applications/AMPPS/perl/lib/site_perl/5.20.2/darwin-2level/auto/DBD/mysql/mysql.bundle' for module DBD::mysql: dlopen(/Applications/AMPPS/perl/lib/site_perl/5.20.2/darwin-2level/auto/DBD/mysql/mysql.bundle, 1): Library not loaded: libmysqlclient.18.dylib
  Referenced from: /Applications/AMPPS/perl/lib/site_perl/5.20.2/darwin-2level/auto/DBD/mysql/mysql.bundle
  Reason: image not found at /Applications/AMPPS/perl/lib/5.20.2/darwin-2level/DynaLoader.pm line 197.
at (eval 7) line 3.
Compilation failed in require at (eval 7) line 3.
Perhaps a required shared library or dll isn't installed where expected
at /Applications/AMPPS/www/cgi-bin/test.cgi line 35.

Can you maybe see, what we are doing wrong? How can we solve the problem?

Thank you!


IP: --   

Problems to connect to MySQL via Perl
Group: Member
Post Group: Newbie
Posts: 1
It seems to me as a newbie that the server does not connect, even if I am from inside the network (running as a CGI on the server, remote connections would be blocked by the web hoster). I hope someone with MySQL experience can give me a lead to fix trouble, and I have been stuck here for a couple of days. The support of the webhoster has not been helpful to date.

More environmental information: The version is Python 3.8.8, mySQL 5.7, mysql connector python 8.0.23. I have no root access, so I can't get to mySQL error log as it is a host webserver. I am sure the login data from mySQL is correct as it does

Life is a Gift
IP: --   

« Previous    Next »

Threaded Mode | Print  

Jump To :

Users viewing this topic
1 guests, 0 users.

All times are GMT. The time now is May 8, 2021, 3:23 am.

  Powered By AEF 1.0.8 © 2007-2008 Electron Inc.Queries: 11  |  Page Created In:2.432