我在mariadb中有两个数据库,我想更新两个数据库,
#Connect to the database1.
my $db1 = DBI->connect("DBI:mysql:database=db1;host=ip",
"login", 'paswword',
{'RaiseError' => 1});
#Connect to the database2.
my $db2 = DBI->connect("DBI:mysql:database=db2;host=ip",
"login", 'password',
{'RaiseError' => 1});
my $query3 = $db1->prepare("
UPDATE worldmap.worldmap_table t1
SET t1.severity = 1000
WHERE t1.host IN
(SELECT h.name
FROM host_inventory as i, hosts as h WHERE i.hostid=h.hostid and h.available=1)");
$query3->execute;
感谢您的回复
使用单个连接。使用db.table语法的参考表。