Using Symbolic Links for Databases on Windows
Symbolic links are enabled by default for all Windows servers. This enables you to put a database directory on a different disk by setting up a symbolic link to it. This is similar to the way that database symbolic links work on Unix, although the procedure for setting up the link is different. If you do not need symbolic links, you can disable them using the --skip-symbolic-links
option.
On Windows, create a symbolic link to a MariaDB database by creating a file in the data directory that contains the path to the destination directory. The file should be named
, where db_name
.symdb_name
is the database name.
Suppose that the MariaDB 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 namedfoo
in the data directory, move it toD:\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 path nameD:\data\foo\
.NoteThe path name to the new database and tables should be absolute. If you specify a relative path, the location will be relative to the
foo.sym
file.
After this, all tables created in the database foo
are created in D:\data\foo
.
The following limitations apply to the use of .sym
files for database symbolic linking on Windows:
- The symbolic link is not used if a directory with the same name as the database exists in the MariaDB data directory.
- The
--innodb_file_per_table
option 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 (
\\servername\path\
).