title: Grant Execute Function permission to another user
body: <p>I have a database function <code>fn_relation_isModerator</code>, only user <code>api</code> has access to this function. Now I want another user to have this permission <em>(while keeping the previous permission as well)</em>.</p>
  
  <p>I checked routine name and user by following query:</p>
  
  <pre><code>select routine_name, routine_type, definer from information_schema.ROUTINES where ROUTINE_SCHEMA = 'db_name';
  </code></pre>
  
  <p>Which resulted:</p>
  
  <pre><code>+-------------------------+---------------+----------+
  |      ROUTINE_NAME       |  ROUTINE_TYPE |  DEFINER |
  +-------------------------+---------------+----------+
  |                         |               |          |
  | fn_relation_isModerator |  FUNCTION     |  api@%   |
  +-------------------------+---------------+----------+
  </code></pre>
  
  <p><strong>Approach 1:</strong></p>
  
  <p>So I ran the following query to grant this permission:</p>
  
  <pre><code>GRANT EXECUTE ON PROCEDURE db_name.fn_relation_isModerator TO 'api_worker'@'%';
  </code></pre>
  
  <p>But it resulted in following error:</p>
  
  <blockquote>
    <p>Error Code: 1305. PROCEDURE fn_relation_isModerator does not exist</p>
  </blockquote>
  
  <p><strong>Approach 2:</strong></p>
  
  <p>Query:</p>
  
  <pre><code>GRANT EXECUTE ON FUNCTION `db_name`.`fn_relation_isModerator` TO 'api_worker'@'%';
  </code></pre>
  
  <p>Error</p>
  
  <blockquote>
    <p>Error Code: 1133. Can't find any matching row in the user table</p>
  </blockquote>
  
  <p><strong>Approach 3:</strong></p>
  
  <p>Query:</p>
  
  <pre><code>GRANT EXECUTE ON `db_name`.`fn_relation_isModerator` TO 'api_worker'@'%';
  </code></pre>
  
  <p>Error:</p>
  
  <blockquote>
    <p>Error Code: 1144. Illegal GRANT/REVOKE command; please consult the
    manual to see which privileges can be used</p>
  </blockquote>