-1

Is it advisable to store images directly in a MySQL database

Is it recommended to upload an image directly to a MySQL database?

if not then whats uses of BLOB Data Type. if yes What size can be stored.

Kindly help me with this

geroge
  • 52
  • 6
  • It's often better to store the image in a file and put the filename in the DB. But we upload images to our database because we have a server farm and it would be hard to replicate the files to all the servers. – Barmar Aug 03 '23 at 14:55
  • If you like having intractably huge backups and tons of additional overhead, sure! If you'd like to have databases that are lean and focused, no. MySQL is a *terrible* file server. Consider using an object-store type database, or a service that specializes in object storage, like S3 or various alternatives and open-source equivalents. Store references to *those* objects in your actual database. – tadman Aug 03 '23 at 15:26
  • It's also a question of scale -- if you want to store 100 small images, it's a totally different thing than 100 million large ones. And of course also depends on what your other architecture looks like. – James Z Aug 03 '23 at 18:00
  • BLOB is not for images only. It's for all binary data like Encrypted data, Serialized objects, data structures etc. Consider how to deal with binary data. Converting large datasets to binary and storing them is the wrong approach. – Shyam Aug 04 '23 at 05:31

0 Answers0