开发者

Bad to Grant reload permission in mysql?

Because of a problem i had with mysql i need to use flush. I discovered the user cannot use flush without the reload permission. and to give it to him my syntax was

grant reload on *.* to 'webapp_wt'@'localhost';

I couldnt do specific_db.*. And grantin开发者_C百科g this kind of permission doesnt feel right. Is there anything wrong with this? Is it possible for this mysql user to cause problems? (outside of the db i gave it permissions to).

-edit- exactly one view and one answer (and its good!) in 45mins. I am amused.

Is there a way to grant flush tables but nothing else?


As it is a server administration thing, you indeed cannot grant it to specific databases/tables (much of which you can do with RELOAD would not make sense for a specific databse or table).

And yes, a user can seriously hinder performance with repeatedly FLUSH'ing tables or FLUSH QUERY CACHE, and can possibly break (lagging) replication with FLUSH MASTER.


It's bad to grant any user access to an admin feature, especially if they dont understand/care about the impact of it behind the scenes (in this case the impact is potentially significant).

personally I would wrap it up in application logic. So instead of the user flushing the tables, he simply sets a flag in your database saying 'hey, i wanna flush'

You can then have script/cronjob which inspects the flag periodically, and add logic to decide when the flush should take place. This also means you get to keep all your admin priviledges to yourself == less headaches

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜