search
HomeDatabaseMysql TutorialReasons and solutions for MySQL reporting Row size too large 65535_MySQL

Error message: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535

When inserting a field into a MySQL table with a field type of text, or modifying a field with a field type of text, the above error will be reported. Actually, I don’t have a deep understanding of the cause of this error. Let me give some explanations that I found

The general idea is that there is a field index with a set length of 64K in the data table. When the fields in the table (I don’t know whether it is a field name or something) cannot exceed this length, 65,535 indicates that the entire table is not large. The total bytes of the fields of the field type. (found online)

My own understanding (it’s not very clear, please point it out):

My understanding is similar to what I found in the last sentence, that is, the total bytes of non-large field types is greater than 64K. What is the total bytes of this field? I'd better think of it as the sum of the field name lengths. Non-large fields refer to those fields. I think they are fields of varchar field type. The sum of their names is greater than 64K. If the storage space of mysql is exceeded, an error will be reported.

Let me briefly explain varchar. Before the old version 5, the maximum number of characters varchar could store was 255 (it’s not scientific, check it out yourself if you’re interested). After version 5, varchar has variable length, which means it stores data according to actual conditions. Divide the occupied storage space by the number. For example, if there are 50 data in the varchar type, then the storage space it occupies may be 51, and 1 is a placeholder to record how many characters are stored. (Perhaps it’s not that the field name occupies 64k, but that the record length in this field is too much, exceeding the value of 64k) In other words, you can check for yourself whether the varchar field type in your data table is used too much. Much more.

It is true that varchar is used too much. What should I do? In fact, the error statement above explains that the attributes can be converted to text or blobs. If it works, you can try it yourself.

Why are there so many varchars in my data table? Because it is the actual length, which can save some storage space. For example, if I give varchar(300) but I actually store 10 words in this field, it is actually just It occupies 11 characters of storage space, with a maximum of 300 characters.

My solution:

Set the attribute fields in the varchar(N) table where N is less than 255, and change the attribute to tinytext. tinytext always takes up 255 characters when stored. It is a fixed occupation, and the maximum number of characters that can be saved is only 255. So if the N value of varchar(N) is particularly small, tinytext can be used instead. Please consider whether you can use char.

The above is the reason and solution for Mysql reporting Row size too large 65535 introduced by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. . Thank you very much for your support of the website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
What Are the Limitations of Using Views in MySQL?What Are the Limitations of Using Views in MySQL?May 14, 2025 am 12:10 AM

MySQLviewshavelimitations:1)Theydon'tsupportallSQLoperations,restrictingdatamanipulationthroughviewswithjoinsorsubqueries.2)Theycanimpactperformance,especiallywithcomplexqueriesorlargedatasets.3)Viewsdon'tstoredata,potentiallyleadingtooutdatedinforma

Securing Your MySQL Database: Adding Users and Granting PrivilegesSecuring Your MySQL Database: Adding Users and Granting PrivilegesMay 14, 2025 am 12:09 AM

ProperusermanagementinMySQLiscrucialforenhancingsecurityandensuringefficientdatabaseoperation.1)UseCREATEUSERtoaddusers,specifyingconnectionsourcewith@'localhost'or@'%'.2)GrantspecificprivilegeswithGRANT,usingleastprivilegeprincipletominimizerisks.3)

What Factors Influence the Number of Triggers I Can Use in MySQL?What Factors Influence the Number of Triggers I Can Use in MySQL?May 14, 2025 am 12:08 AM

MySQLdoesn'timposeahardlimitontriggers,butpracticalfactorsdeterminetheireffectiveuse:1)Serverconfigurationimpactstriggermanagement;2)Complextriggersincreasesystemload;3)Largertablesslowtriggerperformance;4)Highconcurrencycancausetriggercontention;5)M

MySQL: Is it safe to store BLOB?MySQL: Is it safe to store BLOB?May 14, 2025 am 12:07 AM

Yes,it'ssafetostoreBLOBdatainMySQL,butconsiderthesefactors:1)StorageSpace:BLOBscanconsumesignificantspace,potentiallyincreasingcostsandslowingperformance.2)Performance:LargerrowsizesduetoBLOBsmayslowdownqueries.3)BackupandRecovery:Theseprocessescanbe

MySQL: Adding a user through a PHP web interfaceMySQL: Adding a user through a PHP web interfaceMay 14, 2025 am 12:04 AM

Adding MySQL users through the PHP web interface can use MySQLi extensions. The steps are as follows: 1. Connect to the MySQL database and use the MySQLi extension. 2. Create a user, use the CREATEUSER statement, and use the PASSWORD() function to encrypt the password. 3. Prevent SQL injection and use the mysqli_real_escape_string() function to process user input. 4. Assign permissions to new users and use the GRANT statement.

MySQL: BLOB and other no-sql storage, what are the differences?MySQL: BLOB and other no-sql storage, what are the differences?May 13, 2025 am 12:14 AM

MySQL'sBLOBissuitableforstoringbinarydatawithinarelationaldatabase,whileNoSQLoptionslikeMongoDB,Redis,andCassandraofferflexible,scalablesolutionsforunstructureddata.BLOBissimplerbutcanslowdownperformancewithlargedata;NoSQLprovidesbetterscalabilityand

MySQL Add User: Syntax, Options, and Security Best PracticesMySQL Add User: Syntax, Options, and Security Best PracticesMay 13, 2025 am 12:12 AM

ToaddauserinMySQL,use:CREATEUSER'username'@'host'IDENTIFIEDBY'password';Here'showtodoitsecurely:1)Choosethehostcarefullytocontrolaccess.2)SetresourcelimitswithoptionslikeMAX_QUERIES_PER_HOUR.3)Usestrong,uniquepasswords.4)EnforceSSL/TLSconnectionswith

MySQL: How to avoid String Data Types common mistakes?MySQL: How to avoid String Data Types common mistakes?May 13, 2025 am 12:09 AM

ToavoidcommonmistakeswithstringdatatypesinMySQL,understandstringtypenuances,choosetherighttype,andmanageencodingandcollationsettingseffectively.1)UseCHARforfixed-lengthstrings,VARCHARforvariable-length,andTEXT/BLOBforlargerdata.2)Setcorrectcharacters

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools