title: Unable to Run Query in MySQL syntax error unexpected
body: <p>I'm running Workbench 5.2.47.</p>
  
  <p>I have a long procedure I wrote with basic data checking. If a record did not exist in the database, the record would be inserted.</p>
  
  <p>The procedure saved with no problems, but MySQL 5.5 throws an error when I try running it.</p>
  
  <p>It is long, and has a lot of company sensitive data in it, or I would post it here.</p>
  
  <p>I am trying to debug the procedure by executing small chunks of the code, but I can't seem to get Workbench to allow anything I try.</p>
  
  <p>MySQL shows how to create a stored procedure in <a href="http://dev.mysql.com/doc/connector-net/en/connector-net-tutorials-stored-procedures.html" rel="nofollow noreferrer">5.1.5 Working with Stored Procedures</a>.</p>
  
  <p>Let me show you something very basic I am trying to write:</p>
  
  <pre><code>DELIMITER $$
  DROP PROCEDURE IF EXISTS my_test;
  
  CREATE PROCEDURE my_test()
  BEGIN
      SELECT * FROM Employees;
  END $$
  
  DELIMITER ;
  </code></pre>
  
  <p>With that, Workbench gives me the error, "syntax error, unexpected CREATE, expecting $end".</p>
  
  <p><img src="https://i.stack.imgur.com/LVnuH.jpg" alt="screenshot CREATE"></p>
  
  <p>I don't understand that, but I need to get something done, so I am moving on.</p>
  
  <p>I make a simpler query:</p>
  
  <pre><code>SET @Count=(SELECT Count(*) FROM tbl_object_users WHERE username='jp2code');
  IF (@Count &lt; 1) THEN
      INSERT INTO tbl_object_users (username, date_time) VALUES ('jp2code', NOW());
  END IF;
  </code></pre>
  
  <p>Again, I get an error, this time on my IF statement.</p>
  
  <p><img src="https://i.stack.imgur.com/eUhUf.jpg" alt="screenshot IF"></p>
  
  <p>Next, I go into PhpMyAdmin to try running something from there using its database:</p>
  
  <pre><code>SET @Count=Count(id) FROM `tbl_object_users` WHERE `username`='jp2code';
  </code></pre>
  
  <p>It, too, tells me I have an error in my SQL syntax.</p>
  
  <p><img src="https://i.stack.imgur.com/0XJi5.jpg" alt="screenshot phpMyAdmin"></p>
  
  <p>I did download and install the newest Workbench 6, but it did not solve the problem - and I did not like the interface, so I uninstalled it and went back to Workbench 5.2.</p>
  
  <h2>What is going on? SQL isn't that hard, so what is with these hurdles?</h2>