I am trying to connect to mysql running in container through perl script.
Container
1063b3f15b0f mysql:latest "docker-entrypoint.s…" 3 days ago Up 3 days 0.0.0.0:3306->3306/tcp, 33060/tcp test_db
Connections works from host with tcp protocol
mysql -P 3306 --protocol=tcp -u root -p
But not sure how we can specify protocol with DBI in perl
use DBI;
my $driver = "mysql";
my $host = "127.0.0.1";
my $database = "users";
my $dsn = "DBI:$driver:database=$database,host=$host";
my $userid = "root";
my $password = "testpw";
my $dbh = DBI->connect($dsn, $userid, $password ) or die $DBI::errstr;
Fails with error
DBI connect('database=users,host=127.0.0.1','root',...) failed: Access denied for user 'root'@'localhost' (using password: YES) at update_db.pl line 10.
Access denied for user 'root'@'localhost' (using password: YES) at update_db.pl line 10.
Can someone help here to crack it.?