0

So I like to edit databases commandline on the server as root. With this I copied in the LEVENSHTEIN function, which works perfect on the commandline as root.

Butttttt, my website can't use the function seeing it obviously doesn't use root as user but another username.

So my question is simple, how do I give all db users permission to use that specific function.

Matt
  • 1,081
  • 15
  • 27
  • 2
    Use `SQL SECURITY INVOKER` & grant them the `EXECUTE` privilege. – Wrikken Feb 08 '14 at 16:39
  • If been searching for a while now and i still cant get this to work. Could you please be more specific? Like a query. – Matt Feb 08 '14 at 17:21
  • Well, how have you tried to give all users the `EXECUTE` privilege? AFAIK, there's no easy way to grant something to all users, but you'll have to grant it to them each individually. On the database server _itself_, I would normally do something like this from the command line: `SELECT CONCAT('GRANT EXECUTE ON somedatabasename.* TO \'',user,'\',\'',host,'\';') FROM mysql.user INTO OUTFILE '/tmp/grant-execute'; SOURCE /tmp/grant-execute;`. If you can't do it from the server itself, make all those `GRANT` statements by hand. – Wrikken Feb 08 '14 at 17:29
  • Nevermind, got it. I didn't get that the user needed execute rights on the db instead on the function (what i got from dev.mysql) grant execute on [db].* to [user]@localhost; – Matt Feb 08 '14 at 17:30
  • Yeah, granted that's a bit weird in MySQL. If you need it on a single one though, you can use [`GRANT EXECUTE ON PROCEDURE databasename.procedurename`](http://stackoverflow.com/questions/10089308/mysql-stored-procedure-permissions) – Wrikken Feb 08 '14 at 17:42

0 Answers0