If you really want to do this, you could run two separate instances of MySQL, one for each database. Then
- Stop connections to MySQL via socket, and require them all to be by the network interface; let us assume database1's listener is on port 3307, and database2's is on 3308 (MySQL normally listens on 3306).
- Prevent user1-owned processes from connecting to database2's TCP listener, with something like:
iptables -A OUTPUT -p tcp --dport 3307 -o lo -m owner --uid-owner user1 -j REJECT
I'm not advocating this, but if you really, really want to make a user unable even to talk to the wrong database, much less to authenticate to it, this should work.