If you want to grant access to the app databases to the same users, do this:
GRANT ALL PRIVILEGES ON app1.* TO 'user'@'db.domain.com';
GRANT ALL PRIVILEGES ON app2.* TO 'user'@'db.domain.com';
GRANT ALL PRIVILEGES ON app3.* TO 'user'@'db.domain.com';
If you want to replace 'lb.domain.com' with 'db.domain.com' do this:
UPDATE mysql.user SET host='db.domain.com'
WHERE user='user' AND host='lb.domain.com';
UPDATE mysql.db SET host='db.domain.com'
WHERE user='user' AND host='lb.domain.com' AND db in ('app1','app2','app3');
FLUSH PRIVILEGES;
Give it a Try !!!
UPDATE 2011-10-26 12:43 EDT
Perhaps you may want to try masking the domain as follows:
GRANT ALL PRIVILEGES ON app1.* TO 'user'@'%.domain.com';
GRANT ALL PRIVILEGES ON app2.* TO 'user'@'%.domain.com';
GRANT ALL PRIVILEGES ON app3.* TO 'user'@'%.domain.com';
or replacing the domain:
UPDATE mysql.user SET host='%.domain.com'
WHERE user='user' AND host='lb.domain.com';
UPDATE mysql.db SET host='%.domain.com'
WHERE user='user' AND host='lb.domain.com' AND db in ('app1','app2','app3');
FLUSH PRIVILEGES;
That way, any authentication of user from the domain.com domain would be acceptable.
UPDATE 2011-10-26 18:05 EDT
Personally, I hate using DNS names in mysql.user and mysql.db
You can actually get mysqld to bypass having to use DNS as follows
First replace all DNS names with hard IP addresses. Also, replace domain names with IP netblocks (instead of *.domain.com using 10.20.30.%)
Then, add the following to /etc/my.cnf and restart mysql
[mysqld]
skip-name-resolve
skip-host-cache
DNS resolution should, then, become a thing of the past.