saving base64 data - row size too large issue

2019-02-15 13:15发布

问题:

I have 22 database fields of type longtext. If I try saving 12 of the fields with the following data I get the following error:

#1118 - Row size too large. The maximum row size for the used table type, not     
counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs 

It saves fine if I only save 11 fields. Here's the data:

BYOkQoFxB5+S8VH8svilSI/hQCUDlh1wGhyHacxjNpShUKlGJJ5HZ1DQTKGexBaP65zeJksfOnvBloCSbVmNgYxQhaQHn7sJlKjwtC00X/me2K8Vs4I9cL9SZx58Q2iXXQBbJYaAhn0LaEJMUN0P7VWd0/MiKgXsJt0UiXBf7Rlo6JIooBlaf59zA+II1o3MJKmzyH4q7C1qm2bC0LIT79ZCWDDSdqQaKZ1k1gPMu+yDYQPjrNiQUW29K/AdJ/XpPHT50jaJUjoMv9fL2TK0bUMO0VGe+0Cf4j0BE3QHlFnHqdgnLCTWk8NVo5U4Y5XTObsZtWwd1wHFZNIatuvg0cQk6WHojx3H9HavxKs9JJWYp8eCywyLhjmF39jMoZRT4n8fSTGDGif2q3VJE7DQrmQTjyQkSl9yUWvcTTUHAyNRYKnthVbgbzOOhEvhOZPuD4h+dcGyiW/xk+Lvu2XqkMDBIBuLcKymrdhefi4DElpuwyKFH7DNt6Y3fllPN/0XuSF0YXPqnBDLUcZsMqdzWPZX4RoVza/0Do+mHejYUSYnhsFWtPUHlTnU6fojBqw0icoKqhwjcIVpZmATwgYwXclsSwqEBWm9q9DMNzXG73bq6bs29BKq3E9S/fxo9Bz3mThNaj33fhyD4mj8indAIQeLVWvW3dq4T8+0lao6Ll0=

How can I fix the issue? How can I increase the bytes of the row size so it is more than 8126?

回答1:

The problem is the row size limit for InnoDB tables, in this links you can find some approaches to solve this:

  • http://www.mysqlperformanceblog.com/2011/04/07/innodb-row-size-limitation/
  • https://dba.stackexchange.com/questions/6598/innodb-create-table-error-row-size-too-large


回答2:

Columns of type Varchar's, text, and blob arent included in the innodb row size limit.. so if you have a lot of columns that aren't you can get that error.

I had a load of char(1)'s that I changed to varchar and it fixed the problem nicely