1

I want to insert blob data into MySQL database. I am aware of LOAD_FILE but it's not fitting my requirements. Also tried inserting hex value:

INSERT INTO table VALUES (1, x'6210341GG80JF803080G40GG2000000000002400000000001GO0K1G85A34HJHT0G1G4C0Q645J02860DAG82OC08O3EC8B604GC0QL0G1GO0');

But it didn't work.

1
  • when querying it fails Commented Nov 7, 2017 at 14:24

1 Answer 1

1

Use a valid hex value. The value in the question is not valid.

I also suggest that you remove the single quotes and add zero before the x:

INSERT INTO table VALUES (1, 0x6210341fab6210341);
Sign up to request clarification or add additional context in comments.

2 Comments

I am getting this error - ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
That's because the value you have is not hex value. I copied it from your question thinking it was correct and didn't pay attention. Hex values only include a-f characters, but your other invalid characters like G, K. O, Q, etc. Where did you get that value from? Use a valid hex value and query will work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.