On 2 Jun 2003, Scot Needy wrote:
> Hi;
Hi.
> Trying to write a script to backup all my MySQL databases. The number and
> name of the databases may change from day to day so I am trying to use
> data_sources to fetch a list of databases but I can't seem to get this to
> work.
> The database is bound to an IP so localhost doesn't work. How do you set
> host,user,passwd in this DBI call. I read a little about DBI_USER but not
> sure if that is the answer.
There are 2 ways of doing this:
1. @databases = DBI->data_sources("mysql", {"host" => $host, "port" => $port});
2.
my $drh = DBI->install_driver("mysql");
@dbs = $drh->func("$hostname:$port", '_ListDBs');
@dbs = $drh->func($hostname, $port, '_ListDBs');
@dbs = $dbh->func('_ListDBs');
HTH,
Rudy