title: How to retrieve binary file data as converted char in mysql?
body: <p>I'm working on a project that deals with text files that are to be stored in a database. </p>
  
  <p>So i'm using the <code>blob</code> data type, that converts the files into binary and then uploads to MySQL. </p>
  
  <p>My problem is how to convert the entire binary text into char while retrieving it? I tried the php command below but it doesn't seem to work well. Please help.</p>
  
  <pre><code>SELECT cast(blob-col_name as char(1000000)) from `table_name`
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/qKzkP.png" rel="nofollow noreferrer">The output retrieves garbage text as shown in the image below.</a></p>