title: converting varchar to binary in mysql?
body: <p>I have the following data in a table like so:</p>
  
  <pre><code>create table tutor(
     id int,
     accessto varchar(8)
  );
  </code></pre>
  
  <p>The data looks like this:</p>
  
  <pre><code>+-------+----------+
  | id    | accessto |
  +-------+----------+
  |    69 | b'1011'  |
  |   162 | b'1011'  |
  |   232 | b'1011'  |
  |   257 | b'0010'  |
  |   258 | b'1011'  |
  |   258 | b'1011'  |
  |   258 | b'1011'  |
  |   258 | b'1011'  |
  |   258 | b'1011'  |
  |   258 | b'1011'  |
  |   258 | b'1110'  |
  |   258 | b'1001'  |
  |   258 | b'0011'  |
  |   258 | b'1001'  |
  +-------+----------+
  </code></pre>
  
  <p>I want to convert this into binary. How is it possible?</p>
  
  <p>I tried these queries but getting the same result:</p>
  
  <pre><code>select id, cast(accessto as BINARY) from tutor;
  select id, convert(accessto,binary) from tutor;
  </code></pre>
  
  <p>How to do this?</p>
  
  <p><strong>My expected result is should be like this:</strong></p>
  
  <pre><code> +-------+----------+
      | id    | accessto |
      +-------+----------+
      |    69 | 11  |
      |   162 | 11  |
      |   232 | 11  |
      |   257 | 2  |
      |   258 | 11  |
      |   258 | 11  |
      |   258 | 11  |
      |   258 | 11  |
      |   258 | 11  |
      |   258 | 11  |
      |   258 | 14  |
      |   258 | 9  |
      |   258 | 3  |
      |   258 | 9  |
      +-------+----------+
  </code></pre>