title: Set AUTO_INCREMENT value through variable in MySql
body: <p>I have a table with an auto_increment column. I save the last value of the column in another table called ids_tbl, and when mysql restarts, read the value from ids_tbl and re-set the AUTO_INCREMENT value.
  If I do this:</p>
  
  <pre><code>alter table outgoing_tbl auto_increment=500; 
  </code></pre>
  
  <p>it works </p>
  
  <p>But if I do this </p>
  
  <pre><code>select @max_id:= max_id FROM ids_tbl;
  alter table outgoing_tbl auto_increment=@max_id; 
  </code></pre>
  
  <p>or if I do this:</p>
  
  <pre><code>select @max_id:= max_id FROM ids_tbl;
  alter table outgoing_tbl auto_increment=(select @max_id); 
  </code></pre>
  
  <p>Then it does not work, how do I set the auto increment value throgh a variable?</p>