CREATE TABLESPACE Statement Options • ADD DATAFILE : Defines the name of a tablespace data file. This option is always required when creating an  NDB  tablespace; for  InnoDB  in MySQL 8.0.14 and later, it is required only when creating an undo tablespace. The  file_name , including any specified path, must be quoted with single or double quotation marks. File names (not counting the file extension) and directory names must be at least one byte in length. Zero length file names and directory names are not supported. Because there are considerable differences in how  InnoDB  and  NDB  treat data files, the two storage engines are covered separately in the discussion that follows. InnoDB data files.   An  InnoDB  tablespace supports only a single data file, whose name must include a  .ibd  extension. To place an  InnoDB  general tablespace data file in a location outside of the data directory, include a fully qualified path or a path relative to the data directory. Only a fully qualified path is permitted for undo tablespaces. If you do not specify a path, a general tablespace is created in the data directory. An undo tablespace created without specifying a path is created in the directory defined by the innodb_undo_directory  variable. If the  innodb_undo_directory  variable is undefined, undo tablespaces are created in the data directory. To avoid conflicts with implicitly created file-per-table tablespaces, creating an  InnoDB  general tablespace in a subdirectory under the data directory is not supported. When creating a general tablespace or undo tablespace outside of the data directory, the directory must exist and must be known to  InnoDB  prior to creating the tablespace. To make a directory known to  InnoDB , add it to the  innodb_directories  value or to one of the variables whose values are appended to the innodb_directories  value.  innodb_directories  is a read-only variable. Configuring it requires restarting the server. If the  ADD DATAFILE  clause is not specified when creating an  InnoDB  tablespace, a tablespace data file with a unique file name is created implicitly. The unique file name is a 128 bit UUID formatted into five groups of hexadecimal numbers separated by dashes ( aaaaaaaa-bbbb-cccc-dddd- eeeeeeeeeeee ). A file extension is added if required by the storage engine. An  .ibd  file extension is added for  InnoDB  general tablespace data files. In a replication environment, the data file name created on the replication source server is not the same as the data file name created on the replica. As of MySQL 8.0.17, the  ADD DATAFILE  clause does not permit circular directory references when creating an  InnoDB  tablespace. For example, the circular directory reference ( /../ ) in the following statement is not permitted: CREATE TABLESPACE ts1 ADD DATAFILE ts1.ibd ’ any_directory /../ts1.ibd’; An exception to this restriction exists on Linux, where a circular directory reference is permitted if the preceding directory is a symbolic link. For example, the data file path in the example above is permitted if any_directory  is a symbolic link. (It is still permitted for data file paths to begin with ’ ../ ’.) NDB data files.   An  NDB  tablespace supports multiple data files which can have any legal file names; more data files can be added to an NDB Cluster tablespace following its creation by using an  ALTER TABLESPACE  statement. An  NDB  tablespace data file is created by default in the data node file system directory—that is, the directory named  ndb_ nodeid _fs/TS  under the data node’s data directory ( DataDir ), where  nodeid is the data node’s  NodeId . To place the data file in a location other than the default, include an absolute directory path or a path relative to the default location. If the directory specified does not exist,  NDB attempts to create it; the system user account under which the data node process is running must have the appropriate permissions to do so. 2599