title: Syntax error with emulating "create user if not exists"
body: <p>MySQL does not allow you to specify an <code>if not exists</code> clause in a <code>create user</code> statement (despite the fact that <code>create table</code> and <code>create procedure</code> do support this). There was a feature request for this in 2005 but the MySQL devs have done sod all about it, so it's probably not going to happen anytime soon:</p>
  
  <p><a href="http://bugs.mysql.com/bug.php?id=15287" rel="nofollow noreferrer">http://bugs.mysql.com/bug.php?id=15287</a></p>
  
  <p>I'm trying to emulate this functionality with the following statement:</p>
  
  <pre><code>if (select ifnull((select 1
                       from mysql.user
                      where User = 'recuser'
                        and Host = '%'), 0) = 0) then
    create user 'recuser'@'%' identified by password 'blah';
  end if;
  </code></pre>
  
  <p>but MySQL complains about the syntax in the <code>if</code> statement - I can't see anything wrong with it, hopefully someone else can point out what the issue is.</p>
  
  <p>Thanks!</p>