Gidday Sluggers
This perl script tells me that I don't have a MySQL server on my box
(localhost), when I do (The Kmysql stuff confirms it is running - I can
view DBs,tables and content)
It is from 7/99 O'Reilly's MySQL & mSQL book, P156.
I'm trying to run it on a Suse6.4 box, if that makes a dif.
Not knowing perl, my guess is that it not being told where to look or
not detecting the mysql daemon.
Any pointers appreciated.
I would be also interested in any good teach-your-self resources on WWW
to mysql.
#!/usr/bin/perl -w
use strict;
use CGI qw(:standard);
use CGI::Carp;
use DBI;
CGI::use_named_parameters(1);
my ($server, $sock, $host);
my $output = new CGI;
$server = param('server') or $server = '';
my $driver = DBI->install_driver('mysql');
my @databases = $driver->func($server, '_ListDBs');
if (not @databases) {
print header, start_html('title'=>"Information on $host",
'BGCOLOR'=>'white');
print <<END_OF_HTML;
<H1>$server</h1>
$server does not appear to have a running mSQL server.
</body></html>
END_OF_HTML
exit(0);
}
print header, start_html('title'=>"Information on $host",
'BGCOLOR'=>'white');
print <<END_OF_HTML;
<H1>$host></h1>
<p>
$host\'s connection is on socket $sock.
<p>
Databases:<br>
<UL>
END_OF_HTML
foreach (@databases) {
print "<LI>$_\n";
}
print <<END_OF_HTML;
</ul>
</body></html>
END_OF_HTML
exit(0)
--
Terry Collins {:-)}}} Ph(02) 4627 2186 Fax(02) 4628 7861
email: [EMAIL PROTECTED] www: http://www.woa.com.au
WOA Computer Services <lan/wan, linux/unix, novell>
"People without trees are like fish without clean water"
--
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug