Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Images in MySQL

Tags:

mysql

Is there a Image related data type in MySQL that can be used for storing images for each recor?

like image 374
Anil Avatar asked Nov 03 '09 07:11

Anil


People also ask

Can I store images in MySQL?

A Binary Large Object ( BLOB ) is a MySQL data type that can store binary data such as images, multimedia, and PDF files.

What type is image in MySQL?

In MySQL, the preferred data type for image storage is BLOB. However, there are actually three flavors of BLOB. The one you choose depends on the size of the images that you will be storing.

Where are images stored in MySQL?

Generally, when we upload image file in PHP, the uploaded image is stored in a directory of the server and the respective image name is stored in the database. At the time of display, the file is retrieved from the server and the image is rendered on the web page.


1 Answers

Performance-wise it's probably better to store the file as a file on the drive and only write the filename or filepath and maybe the mime type into the database. But as the others say, BLOB is what you seek.

like image 162
Pascal Avatar answered Nov 15 '22 17:11

Pascal