Is there any way to increase the maximum size of blob data stored in MySql without editing server parameters?

I ask, because shared hosting, I cannot change MySql tinctures.

  • 2
    There was a question about storing photos in the database somewhere, and they recommended storing the photos somewhere on the disk, and in the table only the path to them. In this case, your question will no longer be relevant - Donil
  • I need it in the database. I will not upload photos, and no one will prescribe paths to photos. It's easier for them to fill in the database and that's it. You'll probably have to take a VPS server. - Lucky
  • 3
    And if you fill in through some web a muzzle or an application that itself will determine where to shove and the path to them into the base. - IVsevolod
  • @IVsevolod, Well, yes it is, thought. - Lucky
  • Do you need MySQL for this? GridFS in mongodb is great for this. - Andrey Pivovarov

1 answer 1

MySQL has four BLOB types with the following maximum sizes:

  • TINYBLOB - 255 bytes
  • BLOB - 64 Kb
  • MEDUIMBLOB - 16 MB
  • BIGBLOB - 4 GB

Therefore, if you change the type from BLOB to MEDUIMBLOB or even to BIGBLOB you can save almost any file. However, it is highly not recommended. Files are hard to put and retrieve from the database, other database queries can be severely slowed down, especially if you use InnoDB with storage in a single tablespace. It is better to store in the tables only the path to the files, and the files themselves to store on the hard disk or in any specialized file storage - this scheme is much easier to scale.