Rechercher dans le manuel MySQL
8.12.2.2 Using Symbolic Links for MyISAM Tables on Unix
Symbolic link support as described here, along with the
--symbolic-links
option that
controls it, is deprecated and will be removed in a future
version of MySQL. In addition, the option is disabled by
default.
Symlinks are fully supported only for
MyISAM
tables. For files used by tables for
other storage engines, you may get strange problems if you try
to use symbolic links. For InnoDB
tables,
use the alternative technique explained in
Section 15.6.3.6, “Creating a Tablespace Outside of the Data Directory” instead.
Do not symlink tables on systems that do not have a fully
operational realpath()
call. (Linux and
Solaris support realpath()
). To determine
whether your system supports symbolic links, check the value
of the have_symlink
system
variable using this statement:
The handling of symbolic links for MyISAM
tables works as follows:
In the data directory, you always have the data (
.MYD
) file and the index (.MYI
) file. The data file and index file can be moved elsewhere and replaced in the data directory by symlinks.You can symlink the data file and the index file independently to different directories.
To instruct a running MySQL server to perform the symlinking, use the
DATA DIRECTORY
andINDEX DIRECTORY
options toCREATE TABLE
. See Section 13.1.20, “CREATE TABLE Syntax”. Alternatively, if mysqld is not running, symlinking can be accomplished manually using ln -s from the command line.NoteThe path used with either or both of the
DATA DIRECTORY
andINDEX DIRECTORY
options may not include the MySQLdata
directory. (Bug #32167)myisamchk does not replace a symlink with the data file or index file. It works directly on the file to which the symlink points. Any temporary files are created in the directory where the data file or index file is located. The same is true for the
ALTER TABLE
,OPTIMIZE TABLE
, andREPAIR TABLE
statements.-
Note
When you drop a table that is using symlinks, both the symlink and the file to which the symlink points are dropped. This is an extremely good reason not to run mysqld as the
root
operating system user or permit operating system users to have write access to MySQL database directories. If you rename a table with
ALTER TABLE ... RENAME
orRENAME TABLE
and you do not move the table to another database, the symlinks in the database directory are renamed to the new names and the data file and index file are renamed accordingly.If you use
ALTER TABLE ... RENAME
orRENAME TABLE
to move a table to another database, the table is moved to the other database directory. If the table name changed, the symlinks in the new database directory are renamed to the new names and the data file and index file are renamed accordingly.If you are not using symlinks, start mysqld with the
--skip-symbolic-links
option to ensure that no one can use mysqld to drop or rename a file outside of the data directory.
These table symlink operations are not supported:
ALTER TABLE
ignores theDATA DIRECTORY
andINDEX DIRECTORY
table options.
Traduction non disponible
Le manuel MySQL n'est pas encore traduit en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Document créé le 26/06/2006, dernière modification le 26/10/2018
Source du document imprimé : https://www.gaudry.be/mysql-rf-symbolic-links-to-tables.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.