MySQL Tutorial for How to Load a Picture

The MySQL database allows you to store images in a table field data type called a "BLOB." A BLOB stores binary information, so the image and its data are stored for future use, and you do not need to store the file on a Web server. Instead, the database table loads the file in the table. You use MySQL's Query Browser to load the image.

Instructions

    • 1

      Open Query Browser on a computer that has a connection to the MySQL server. Log in to the database server with your username and password.

    • 2

      Click the "New" button to open a new query editor window. Type the following code to create the query that loads the image into the database:

      insert into image_table (image) values ('file.jpg');

      Replace "image_table" with the table you want to use to store the image. Replace the image file with the path and name of the file.

    • 3

      Click the "Execute" button. The query executes and loads into the database server. To test and make sure the image loaded, type the following query into the editor:

      select * from image_table order by id desc

Related Searches:

References

Comments

Related Ads

Featured