
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
What is the maximum length of a table name in MySQL?
The maximum length of a table name is 64 characters long according to MySQl version 8.0.12.
Check your installed MySQL version.
mysql> select version();
The following is the output.
+-----------+ | version() | +-----------+ | 8.0.12 | +-----------+ 1 row in set (0.03 sec)
We can check the maximum length of the table name at the time of creating it. If we give more than 64 characters, then it will not create a table and an error is thrown.
Creating a table which has more than 64 characters of table name.
mysql> create table tableNameDemotableableNameDemotableableNameDemotableableNameDemotable -> ( -> id int -> ); ERROR 1059 (42000): Identifier name 'tableNameDemotableableNameDemotableableNameDemotableableNameDemotable' is too long
In the above, we get an error that the identifier name (yourTableName) is too long.
To check if it will work for 64 characters or below −
mysql> create table Demo -> ( -> id int -> ); Query OK, 0 rows affected (0.46 sec)
Yes, less than 64 characters for a table name works correctly.
- Related Articles
- Maximum Table name length in SAP HANA
- What is the maximum length of MySQL VARCHAR column?
- What is the maximum length of each type of identifier in MySQL?
- What is the maximum length of data we can put in a BLOB column in MySQL?
- What is the maximum length of data we can put in a TEXT column in MySQL?
- What is the maximum length of string in Python?
- Get the average row length of a MySQL table
- Underscore as a table name in MySQL is possible?
- Maximum Column name length in SAP HANA
- Select the maximum for each value in a MySQL table?
- How can we change the name of a MySQL table?
- What is the Maximum Value of smallint(6) unsigned in MySQL?
- Do underscores in a MySQL table name cause issues?
- Can we give underscore in a MySQL table name?
- What is the syntax in MySQL to get the column names of a table?

Advertisements