Documentation Home
MySQL 8.0 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 40.6Mb
PDF (A4) - 40.7Mb
PDF (RPM) - 40.2Mb
HTML Download (TGZ) - 10.7Mb
HTML Download (Zip) - 10.7Mb
HTML Download (RPM) - 9.3Mb
Man Pages (TGZ) - 241.8Kb
Man Pages (Zip) - 346.8Kb
Info (Gzip) - 3.9Mb
Info (Zip) - 3.9Mb
Excerpts from this Manual

MySQL 8.0 Reference Manual  /  ...  /  Using Symbolic Links for Databases on Unix

8.12.2.1 Using Symbolic Links for Databases on Unix

On Unix, symlink a database using this procedure:

  1. Create the database using CREATE DATABASE:

    mysql> CREATE DATABASE mydb1;

    Using CREATE DATABASE creates the database in the MySQL data directory and permits the server to update the data dictionary with information about the database directory.

  2. Stop the server to ensure that no activity occurs in the new database while it is being moved.

  3. Move the database directory to some disk where you have free space. For example, use tar or mv. If you use a method that copies rather than moves the database directory, remove the original database directory after copying it.

  4. Create a soft link in the data directory to the moved database directory:

    shell> ln -s /path/to/mydb1 /path/to/datadir

    The command creates a symlink named mydb1 in the data directory.

  5. Restart the server.