If the domains are on the same server they can use the same database logins as localhost.
Alternatively, each domain could be a separate database user (sharing the same database).
Each database has users with grant privileges given (configured) by the database root.
root@localhost
Code:
mysql -u root -p
Enter password:*******
CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP
ON `databasesprefix%`.* TO user@localhost IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
A database user (MySQL) can have a difference user name and password than the UNIX (webroot user) -- they probably should.
You can allow database remote connections restricted only to authorized static IPs also.