SELECT * INTO OUTFILE '.txt' FROM WHERE GalleryId= table backup to .txt starting. table backup to .txt completed.