DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

(mysql.info.gz) Symbolic links to databases

Info Catalog (mysql.info.gz) Symbolic links (mysql.info.gz) Symbolic links (mysql.info.gz) Symbolic links to tables
 
 7.6.1.1 Using Symbolic Links for Databases on Unix
 ..................................................
 
 On Unix, the way to symlink a database is to first create a directory
 on some disk where you have free space and then create a symlink to it
 from the MySQL data directory.
 
      shell> mkdir /dr1/databases/test
      shell> ln -s /dr1/databases/test /PATH/TO/DATADIR
 
 MySQL doesn't support linking one directory to multiple databases.
 Replacing a database directory with a symbolic link will work fine as
 long as you don't make a symbolic link between databases.  Suppose that
 you have a database `db1' under the MySQL data directory, and then make
 a symlink `db2' that points to `db1':
 
      shell> cd /PATH/TO/DATADIR
      shell> ln -s db1 db2
 
 For any table `tbl_a' in `db1', there also appears to be a table
 `tbl_a' in `db2'.  If one client updates `db1.tbl_a' and another client
 updates `db2.tbl_a', there will be problems.
 
 If you really need to do this, you can change one of the source files.
 The file to modify depends on your version of MySQL. For MySQL 4.0 and
 up, look for the following statement in the `mysys/my_symlink.c' file:
 
      if (!(MyFlags & MY_RESOLVE_LINK) ||
          (!lstat(filename,&stat_buff) && S_ISLNK(stat_buff.st_mode)))
 
 Before MySQL 4.0, look for this statement in the `mysys/mf_format.c'
 file:
 
      if (flag & 32 || (!lstat(to,&stat_buff) && S_ISLNK(stat_buff.st_mode)))
 
 Change the statement to this:
 
      if (1)
 
 On Windows, you can use internal symbolic links to directories by
 compiling MySQL with `-DUSE_SYMDIR'. This allows you to put different
 databases on different disks.  Windows symbolic links.  (It is
 necessary to define `USE_SYMDIR' explicitly only before MySQL 4.0.  As
 of MySQL 4.0, symbolic link support is enabled by default for all
 Windows servers.)
 
Info Catalog (mysql.info.gz) Symbolic links (mysql.info.gz) Symbolic links (mysql.info.gz) Symbolic links to tables
automatically generated byinfo2html