Click here to Skip to main content
15,354,006 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
ERROR 1048 (23000): Column 'images' cannot be null

The path is correct but is still showing this error

Field  | Type        | Null | Key | Default | Extra |
+--------+-------------+------+-----+---------+-------+
| id     | int         | NO   | PRI | NULL    |       |
| name   | varchar(20) | NO   |     | NULL    |       |
| code   | varchar(10) | NO   |     | NULL    |       |
| amount | int         | NO   |     | NULL    |       |
| images | longblob    | NO   |     | NULL    |       |
| status | varchar(10) | NO   |     | NULL


What I have tried:

SQL
INSERT INTO product(id,name,code,amount,images,status)
VALUES
(1,"It Ends with us:A Novel",'A#99',100,LOAD_FILE('home/mohitlakhwani/Desktop/Photos/1.jpg'),"In-Stock");
Posted
Updated 21-Feb-22 7:11am
v2
Comments
_Asif_ 21-Feb-22 7:11am
   
You need to check whether file is present at $MYSQLSERVER/home/mohitlakhwani/Desktop/Photos location
Mohit Lakhwani 2022 21-Feb-22 7:15am
   
How can i do this?
Richard MacCutchan 21-Feb-22 7:50am
   
Look in that directory. Also check that LOAD_FILE actually returns the data.

1 solution

As my collegues suggested, i'd try to find out what LOAD_FILE function returns:
C#
SELECT LOAD_FILE('home/mohitlakhwani/Desktop/Photos/1.jpg');


Then, i'd follow this article: Ubuntu Linux: Disable Apparmor For Specific Profile / Service Such As Mysqld Server[^]

Quote:

Commands to disable one profile



The syntax is:



BAT
sudo ln -s /etc/apparmor.d/{profile.name-here} /etc/apparmor.d/disable/
sudo apparmor_parser -R /etc/apparmor.d/{profile.name-name-here}


To disable a profile called mysql i.e. disable apparmore protection for mysql server, enter:



BAT
sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld


Verify that mysqld protection is disabled:


BAT
sudo aa-status
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900