0

I am having trouble connecting to a database. Below is the Perl script that doesn't work:

use DBI;   

my $dbh = DBI->connect(
    'dbi:mysql:orders;mysql_socket:/opt/lampp/var/mysql/mysql.sock',
    $username,
    $password,
    { RaiseError => 0, AutoCommit => 0 },
)
  or die $DBI::errstr;

Normally when I try to open the mysql.sock file using open function there is a error but I can't open it.

amon
  • 57,091
  • 2
  • 89
  • 149
pavan
  • 334
  • 6
  • 20

1 Answers1

6

You should use '=' for extra parameters in dsn, so be it:

'dbi:mysql:orders;mysql_socket=/opt/lampp/var/mysql/mysql.sock',
kompas
  • 427
  • 2
  • 10