pison Posted July 15, 2012 Posted July 15, 2012 I've tried this: $dbh = DBI->connect("DBI:mysql:kymercer_obits:[dbserver]", [user], undef, undef); I've put various things in for dbserver and user, but keep getting messages like this: Access denied for user 'kymercer'@'localhost' (using password: NO) In the above example, I'd put 'kymercer' in for user, and 'localhost' as the server. What should I put here to get it to connect? Any help appreciated.
Tjoene Posted July 16, 2012 Posted July 16, 2012 Try this: #!/usr/bin/perl use strict; use DBI; my $host = "localhost"; my $database = "database1"; my $port = 3307; my $tablename = "table1"; my $user = "userName"; my $pw = "pass"; my $dbh = DBI->connect("DBI:mysql:database=$database;host=$host;port=$port",$user, $pw) or die "Cannot connect to MySQL server\n"; source: http://stackoverflow.com/questions/2248665/perl-script-to-connect-to-mysql-server-port-3307
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now