#!/usr/bin/perl use DBI; use strict; use warnings; use utf8; binmode(STDIN, ":utf8"); binmode(STDOUT, ":utf8"); my $user = "root"; my $host = "localhost"; my $db = "gv"; print "Jelszó: "; #eof() ? exit : binmode(ARGV, ":utf8"); my $pass = <>; chop($pass); my $sql = "select gondviselo from 10a"; my $dbh = DBI->connect("DBI:mysql:$db:$host", $user, $pass); $dbh->do("SET NAMES utf8"); $dbh->do("SET CHARACTER SET utf8"); $dbh->{'mysql_enable_utf8'} = 1; my $res = $dbh->prepare($sql); $res->execute; while(my @row = $res->fetchrow_array()) { print $row[0]."\n"; } $res->finish; $dbh->disconnect;