# # Test the limits of a file-per-table tablespace name. MySQL combines # the database name with the table name to make a unique table name. # SET default_storage_engine=InnoDB; # # MySQL limits each database and tablename identifier to 64 characters # of up to 3 bytes per character, corresponding to 192 bytes. # CREATE DATABASE `this_sixty_five_byte_name_is_too_long____________________________`; ERROR 42000: Identifier name 'this_sixty_five_byte_name_is_too_long____________________________' is too long CREATE DATABASE `this_sixty_four_byte_name_is_not_too_long_______________________`; USE `this_sixty_four_byte_name_is_not_too_long_______________________`; # # A 64 character tablename can be created in a 64 character database name # CREATE TABLE `this_sixty_four_byte_name_is_not_too_long_______________________`.`this_sixty_four_byte_name_is_not_too_long_______________________` (a SERIAL); # # A 65 character tablename is too long. # CREATE TABLE `test`.`this_sixty_five_byte_name_is_too_long____________________________` (a SERIAL); ERROR 42000: Identifier name 'this_sixty_five_byte_name_is_too_long____________________________' is too long CREATE TABLE `this_sixty_four_byte_name_is_not_too_long_______________________`.`this_sixty_five_byte_name_is_too_long____________________________` (a SERIAL); ERROR 42000: Identifier name 'this_sixty_five_byte_name_is_too_long____________________________' is too long # # Show the successfully created database and table # SHOW CREATE TABLE `this_sixty_four_byte_name_is_not_too_long_______________________`.`this_sixty_four_byte_name_is_not_too_long_______________________`; Table Create Table this_sixty_four_byte_name_is_not_too_long_______________________ CREATE TABLE `this_sixty_four_byte_name_is_not_too_long_______________________` ( `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT, UNIQUE KEY `a` (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ---- list_files MYSQLD_DATADIR/this_sixty_four_byte_name_is_not_too_long_______________________ this_sixty_four_byte_name_is_not_too_long_______________________.ibd SELECT name FROM information_schema.innodb_tables WHERE name LIKE '%long%'; name this_sixty_four_byte_name_is_not_too_long_______________________/this_sixty_four_byte_name_is_not_too_long_______________________ SELECT name FROM information_schema.innodb_tablespaces WHERE name LIKE '%long%'; name this_sixty_four_byte_name_is_not_too_long_______________________/this_sixty_four_byte_name_is_not_too_long_______________________ SELECT path FROM information_schema.innodb_datafiles WHERE path LIKE '%long%'; PATH ./this_sixty_four_byte_name_is_not_too_long_______________________/this_sixty_four_byte_name_is_not_too_long_______________________.ibd SELECT file_name, tablespace_name FROM information_schema.files WHERE file_name LIKE '%long%'; FILE_NAME ./this_sixty_four_byte_name_is_not_too_long_______________________/this_sixty_four_byte_name_is_not_too_long_______________________.ibd TABLESPACE_NAME this_sixty_four_byte_name_is_not_too_long_______________________/this_sixty_four_byte_name_is_not_too_long_______________________ # # A 64 character tablename can cause a partitioned table # to have a path that is too long. # CREATE TABLE TH6EDXFX5D1U5BLB3I50LN5DFO415JIRP9XKUC0H9O2IONKQL3IOMFYW4ZVOCFPP (a INT NOT NULL, b INT) PARTITION BY RANGE (a) PARTITIONS 3 SUBPARTITION BY KEY (b) (PARTITION O8W7066AGXADOMYWHT89TWMBJOMTFDMDC74WJ7IUPKD75LVU1ENOV1J008SJBKKF VALUES LESS THAN (200) (SUBPARTITION YWKQ987ZTKDJ33ZBMLW526153X86VXL4X44R15SPF8JQS92665MT0QI6BSNKAZY5, SUBPARTITION OSYA45V7KKPJ840E4CZ7CKFXDT3J1NNM8QTT9BQOF896CAZVWFY4K236VHYD1WXN, SUBPARTITION M6YGLCVSKPSVF1RYZA4XJNP7HP9P7OKBP0268T2HKJ0005BW3LLSALQJ94UE5ZSV), PARTITION F3HRUC798U6YIBQFSC9BDKOAUH2SD6B0A3IA7J4P2V8M5U84AAVCR27NNQGM8NI3 VALUES LESS THAN (600) (SUBPARTITION YKWIEPEMRMG097FJ0D8WBJC9TF93GW7GVSU8H0MXYSX940JYO0RNVR4W7YYEZDSF, SUBPARTITION WDJZ36D1IMDRB4ZABLZXWE7J00OP1WR028V1PREZN46PK9L3Y3ERVTWKXYTMC08W, SUBPARTITION KRR0PI4ZBU50X4YVWKDA65PFYRNB69EV5LMM3CMBUVUEIHN2MPY30O8J8WEOOG2Q), PARTITION UYZ1675BEXI942ED7EUYLK03GM90QG3ZGYBLBKGLNWVYNVYUZ70J78BJWYLGS6CV VALUES LESS THAN (1800) (SUBPARTITION XIYZDGAOHPZH1R6RTKURMSUENS8VIN1U1CL7T2594FWR1ELS55UDVDWVX65K3WPE, SUBPARTITION J64S0S338J2AV273XIHW1QHFRK9ZVLSIGSXFF4E22RYCLAG2J3H04PN6M70OB39Y, SUBPARTITION XRL60IN1WNLR4YQAIILJTB9XCDP7Z4CUXRCY9Y2ES55W6UQERG51QV1UYTMZW673)); ERROR HY000: Long database name and identifier for object resulted in a path length too long for table 'th6edxfx5d1u5blb3i50ln5dfo415jirp9xkuc0h9o2ionkql3iomfyw4zvocfpp'. Please check the path limit for your OS. # # Cleanup # USE test; DROP DATABASE `this_sixty_four_byte_name_is_not_too_long_______________________`;