j***y 发帖数: 2074 | 1 Hi, all:
I tried two scripts, which are to use a configuration file to free users from
inputing username, password, etc manually.
Here is the file "my.cnf":
# My configuration file
[client]
user=root
password=rochester
Here is the file "mysql_connect2.pl":
#!d:/perl/bin/perl
# Use what needs to be used.
use DBI;
use strict;
# Connect to the database.
my $user;
my $password;
my $dbh =
DBI->connect('DBI:mysql:mylibrary;mysql_read_default_file=c:\my.cnf', $user,
$password, {RaiseError => 1});
# Rep |
|