使用符号链接吧,下面是mysql 5.0手册上的例子。
Suppose that the MySQL data directory is C:\mysql\data and you want to have database foo located at D:\data\foo. Set up a symlink using this procedure Make sure that the D:\data\foo directory exists by creating it if necessary. If you already have a database directory named foo in the data directory, you should move it to D:\data. Otherwise, the symbolic link will be ineffective. To avoid problems, make sure that the server is not running when you move the database directory. Create a text file C:\mysql\data\foo.sym that contains the pathname D:\data\foo\. After this, all tables created in the database foo are created in D:\data\foo. Note that the symbolic link is not used if a directory with the same name as the database exists in the MySQL data directory. 假设你的mysql安装在c:\mysql,数据目录就是c:\mysql\data,现在你想在D盘建立一个名为foo的数据库,路径为d:\data\foo.
首先:保证d:\data\foo目录存在,如果没有就创建或者你c:\mysql\data下面有,就把它剪切过来,当然在停止mysql的情况下作移动,否则是不起任何作用的。
再次:在c:\mysql\data目录下建立一个文本文件命名为foo.sym,文件名与数据库名相同,后缀名为sym,里面的内容为:D:\data\foo\,就是foo数据库的绝对路径。