I have a mysql database with a blob field containing zip and I need to save it as a file on disk, from bash. I am doing the following, but the end result is not readable as zip ... Am I doing something wrong or the file is not actually zip (is the record in the database actually created by the seismological station, so I do not control it)?
echo "USE database; SELECT blobcolumn FROM table LIMIT 1" | mysql -u root > file.zip
then I open the .zip file with a file editor and delete the first row containing the column heading. Then "unzip" does not recognize it as a zip file.
source
share