Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New Coder
    Join Date
    Sep 2016
    Posts
    60
    Thanks
    22
    Thanked 0 Times in 0 Posts

    How to insert image directly in mysql using command?

    Hello sir,
    I am trying to inset a small image img.png (57.7KB) into mysql database. Table structure is id(int) and image(blob). I directly inserting image can cause problems but I need this for test purpose.

    I can insert the image using localhost/phpmyadmin but
    when I try command-line using the following command:
    Code:
    insert into image(id,image) values (2,load_file('f:\img.png'));
    or
    Code:
    insert into image(id,image) values (2,load_file('f:\\img.png'));
    error occurs :-
    ERROR 1048 (23000): Column ‘image’ cannot be null

    I am using windws 10 os and WampServer 3.1.7 64 bit.

    Please help.
    Last edited by prohor; Jun 25th, 2019 at 05:32 PM.


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •