Mysql
 sql >> Database >  >> RDS >> Mysql

Come inserire file BLOB e CLOB in MySQL?

Due modi:

1 - Utilizzare un LOAD_FILE funzione -

INSERT INTO table1 VALUES(1, LOAD_FILE('data.png'));

2 - Inserisci il file come stringa esadecimale, ad es. -

INSERT INTO table1 VALUES 
  (1, x'89504E470D0A1A0A0000000D494844520000001000000010080200000090916836000000017352474200AECE1CE90000000467414D410000B18F0BFC6105000000097048597300000EC300000EC301C76FA8640000001E49444154384F6350DAE843126220493550F1A80662426C349406472801006AC91F1040F796BD0000000049454E44AE426082');