how to access multiple databases in a single mysql query

assume 2 databases: db1 and db2

create database db1;
use db1;
create table t1 ( name varchar(40), fone varchar(20) );
insert into t1 values ('foo', '555-1212'), ('bar', '555-9999');
create database db2;
use db2;
create table t2 ( who varchar(40), what varchar(20) );
insert into t2 values ('baz', 'blah1'), ('foo', 'blah2');

we want to get the phone number from table t1 that matches the person, "who", from table t2. this query will access tables from both databases:

use db1;
select name, fone from t1
where name = 'foo' and name in
(select x.who from db2.t2 x);

prints:

+------+---------+
| name | fone    |
+------+---------+
| foo  | 5551212 |
+------+---------+

or…

use db1;
select name, fone from t1
where name in
(select x.who from db2.t2 x where x.what = 'blah2');

prints:

+------+---------+
| name | fone    |
+------+---------+
| foo  | 5551212 |
+------+---------+