user5225773
user5225773

Reputation: 125

LOAD_FILE doesnt update Mysql

Do I have to save image files to specific location to update MYSQL product image field using LOAD_FILE.

I used the following code, First I get 29 rows affected message but Nothing was updated when i tried again it using the same statement i get 0 rows affected

i used

        UPDATE ts
        SET product_Image=LOAD_FILE('file:///C:/Users/user/Desktop/aaa/xxx/yyy/TM900.jpg')
        WHERE Brand_Name='TM900';

I have seen some example and most people use '/tmp/picture/' Is there any specific Location to store Files and use LOAD_FILE command?

Upvotes: 1

Views: 124

Answers (1)

thepiyush13
thepiyush13

Reputation: 1331

Just a guess but could your file path be the reason ? try using following file path :

UPDATE ts
       SET
product_Image=LOAD_FILE('C:\\Users\user\Desktop\aaa\xxx\yyy\TM900.jpg')
    WHERE Brand_Name='TM900';

Update : login with root user and try this :

grant all privileges on *.* to youruser@localhost identified by 'yourpass' with grant option;
flush privileges;

Upvotes: 1

Related Questions