On Windows, symbolic links can be used for database directories. This enables you to put a database directory at a different location (for example, on a different disk) by setting up a symbolic link to it. Use of database symlinks on Windows is similar to their use on Unix, although the procedure for setting up the link differs.
Suppose that you want to place the database directory for a
D:\data\mydb. To do this, create a
symbolic link in the MySQL data directory that points to
D:\data\mydb. However, before creating
the symbolic link, make sure that the
D:\data\mydb directory exists by creating
it if necessary. If you already have a database directory
mydb in the data directory, move it
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.
On Windows, create a symbolic link to a MySQL database by
.sym file in the data
directory that contains the path to the destination directory.
The file should be named
db_name is the database name.
Support for database symbolic links on Windows using
.sym files is enabled by default. If you
do not need
.sym file symbolic links, you
can disable support for them by starting
mysqld with the
option. To determine whether your system supports
.sym file symbolic links, check the value
variable using this statement:
SHOW VARIABLES LIKE 'have_symlink';
To create a
.sym file symlink, use this
Change location into the data directory:
In the data directory, create a text file named
mydb.symthat contains this path name:
The path name to the new database and tables should be absolute. If you specify a relative path, the location will be relative to the
After this, all tables created in the database
mydb are created in
The following limitations apply to the use of
.sym files for database symbolic linking
The symbolic link is not used if a directory with the same name as the database exists in the MySQL data directory.
--innodb_file_per_tableoption cannot be used.
If you run mysqld as a service, you cannot use a mapped drive to a remote server as the destination of the symbolic link. As a workaround, you can use the full path (