Rajat Joshi
Rajat Joshi

Reputation: 1

How to store large amount of data in MySQL database through phpmyadmin?

I have approximately 4 GB(34,000) of JPEG files that I need to store in MySQL table. Each image is of different date varying from 1-jan-1961 to 31-dec-2007. How should I store these files such that when I enter the specific date between this time interval the corresponding image appears in my localhost server. The MySQL table has following schema ID, date(that is being entered by the user end), file name, type, size.Is there any way I can upload these files(images) in chunk and not one by one.

Upvotes: 0

Views: 1515

Answers (2)

Tom Desp
Tom Desp

Reputation: 921

First, PHPMyAdmin is not a good choice for end-user GUI, it's preferably used as SQL Web client for DB developers and administrators.

Second, you should not use MySQL to store images, SQL manipulation of big data blobs is quite inefficient compared to direct filesystem access. This point has been debated many times on this site :

You should instead :

  1. use any file transfer command to upload all your files to your web server: rsync, scp, ftp, etc. I'd recommend rsync for further updates and syncing.
  2. use any server side scripting language (PHP, Python, etc.) to parse your uploaded files and reference them in a metadata only table
  3. build a simple HTML GUI with the same language to give access to the wanted images.

Hope it helps.

Upvotes: 0

Malinga
Malinga

Reputation: 515

Always use mySQL client to do the bulk uploads, You can use the native mysql client or a PHP client. However all these years i didn't have to save a image in MySQL. It is hard to manage and have bad effect on the DB performance.

I recommend you to keep only a file URL in the database and have the files elsewhere, it can be local or some other image host. However with this you need to take care of some stuff of your own

  1. Backing up the images separately when you take MySQL backup, as images are no longer in DB
  2. Handling transactions and rollbacks
  3. Handling deletes

If you can manage with your code, I suggest you to move your images out form the database

Upvotes: 1

Related Questions