Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> MySQL

Độ dài tối đa của tên bảng trong MySQL?


Theo MySQL 8.0.12, tên bảng tối đa 64 ký tự.

Kiểm tra phiên bản

mysql> SELECT VERSION();
+-----------+
| VERSION() |
+-----------+
| 8.0.12    |
+-----------+
1 row in set (0.03 sec)

Thử tạo bảng tên > 64 ký tự

mysql> CREATE TABLE tableNameDemotableableNameDemotableableNameDemotableableNameDemotable (
    -> id INT
    -> );
ERROR 1059 (42000): Identifier name 'tableNameDemotableableNameDemotableableNameDemotableableNameDemotable' is too long

Thử tên ≤ 64 ký tự

mysql> CREATE TABLE Demo (id INT);
Query OK, 0 rows affected (0.46 sec)

Tên bảng ≤ 64 ký tự hoạt động bình thường.