mySQL query connection + Perl CGI

I’m trying to create a Perl CGI script to access my mySQL database to pull dynamic data. However, I cannot find a way to connect. I’ve seen a couple other posts similar to this, but the answer was always found offlist and not written down to help those of us coming along later.

Please help!

use DBI;

my $dbh = DBI->connect("DBI:mysql:database=my_dbname;", "mysql_user", "mysql_password");
my $sth = $dbh->prepare("SELECT * FROM table WHERE column = ? ORDER BY blah");
while(my ($x, $y) = $sth->fetchrow_array) {
  do_stuff($x, $y);

For more details, see:

Thank you so much!!!

It’s been too long since I’ve done any Perl DBI programming. This used to be second nature to me. C’est la vie!