title: How to display the value of a variable at the commandline in MySQL?
body: <p>I tried the following - </p>
  
  <p>I created a variable at the command prompt as follows - </p>
  
  <pre><code>mysql&gt; set @myId = 1;
  Query OK, 0 rows affected (0.00 sec)
  </code></pre>
  
  <p>Then, to display it, I tried the following without success - </p>
  
  <pre><code>    mysql&gt; show myId;
      ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that 
  corresponds to your MySQL server version for the right syntax to use near 'myId' at line 1
      mysql&gt; show @myId;
      ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
  corresponds to your MySQL server version for the right syntax to use near '@myId' at line 1
      mysql&gt; PRINT @myId;
      ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that 
  corresponds to your MySQL server version for the right syntax to use near 'PRINT @myId' at line 1
      mysql&gt; PRINT myId;
      ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that 
  corresponds to your MySQL server version for the right syntax to use near 'PRINT myId' at line 1
  </code></pre>
  
  <p>So how can I display the value of <code>@myId</code>? </p>