Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 79683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:11:03+00:00 2026-05-10T21:11:03+00:00

What is the equivalent of varchar(max) in MySQL?

  • 0

What is the equivalent of varchar(max) in MySQL?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T21:11:04+00:00Added an answer on May 10, 2026 at 9:11 pm

    The max length of a varchar is subject to the max row size in MySQL, which is 64KB (not counting BLOBs):

    VARCHAR(65535) 

    However, note that the limit is lower if you use a multi-byte character set:

    VARCHAR(21844) CHARACTER SET utf8 

    Here are some examples:

    The maximum row size is 65535, but a varchar also includes a byte or two to encode the length of a given string. So you actually can’t declare a varchar of the maximum row size, even if it’s the only column in the table.

    mysql> CREATE TABLE foo ( v VARCHAR(65534) ); ERROR 1118 (42000): Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs 

    But if we try decreasing lengths, we find the greatest length that works:

    mysql> CREATE TABLE foo ( v VARCHAR(65532) ); Query OK, 0 rows affected (0.01 sec) 

    Now if we try to use a multibyte charset at the table level, we find that it counts each character as multiple bytes. UTF8 strings don’t necessarily use multiple bytes per string, but MySQL can’t assume you’ll restrict all your future inserts to single-byte characters.

    mysql> CREATE TABLE foo ( v VARCHAR(65532) ) CHARSET=utf8; ERROR 1074 (42000): Column length too big for column 'v' (max = 21845); use BLOB or TEXT instead 

    In spite of what the last error told us, InnoDB still doesn’t like a length of 21845.

    mysql> CREATE TABLE foo ( v VARCHAR(21845) ) CHARSET=utf8; ERROR 1118 (42000): Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs 

    This makes perfect sense, if you calculate that 21845*3 = 65535, which wouldn’t have worked anyway. Whereas 21844*3 = 65532, which does work.

    mysql> CREATE TABLE foo ( v VARCHAR(21844) ) CHARSET=utf8; Query OK, 0 rows affected (0.32 sec) 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 73k
  • Answers 73k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer To call an external program from Python, use the subprocess… May 11, 2026 at 1:52 pm
  • added an answer What I have done is use page caching, and then… May 11, 2026 at 1:52 pm
  • added an answer [DllImport('ws2_32.dll', CharSet = CharSet.Auto, SetLastError = true)] static extern Int32… May 11, 2026 at 1:52 pm

Related Questions

No related questions found

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.