Store each database in a different directory

No built-in way of doing that I'm afraid, the way mysql works is just defining the datadir and then all databases are supposed to be there in their directories.

If you want to do that just make sure that the user that mysql is running in has access to the final directories, soft links should be fine I think.


Surprisingly, the only built-in symlinking of individual MyISAM tables
is done by the CREATE TABLE command as follows:

CREATE TABLE
(
...
) ENGINE=MyISAM
DATA_DIRECTORY='absolute path of data folder'
INDEX_DIRECTORY='absolute path of index folder';

Goto http://dev.mysql.com/doc/refman/5.0/en/create-table.html and locate the DATA_DIRECTORY and INDEX_DIRECTORY options.

Only the .frm file stays in the original server.

BTW These options do not work in Windows version of MySQL. These options are not available for InnoDB.


http://dev.mysql.com/doc/refman/5.5/en/innodb-multiple-tablespaces.html :

With multiple tablespaces enabled, InnoDB stores each newly created table in its own tbl_name.ibd file in the appropriate database directory