• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to prevent a user from dropping tables

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello fellow ranchers

I need some information on how to grant/revoke privileges on mysql database.

Basically I want to create a user and grant him select,insert and update permissions on the database. This is the user with which I'm connecting from my web app to perform operations.

So I connect as root and create the database discountweb - then I'm using the following command

GRANT SELECT, INSERT, UPDATE ON discountweb.* TO 'discountweb'@'localhost' IDENTIFIED BY 'test123' WITH GRANT OPTION;

This works fine - but this user (discountweb) also has the option to drop any table.

Can anyone let me know - how to revoke the drop privilege for this user.

Thanks
 
Gilbert johnson
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And also this user is able to drop the whole database.

So he should not be able to drop tables or database.

Thanks
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
REVOKE drop_database FROM user ON my_database; ?

Not sure of the exact syntax, but it will be something like that.
If that doesn't work, go through your database instructions and look for revoke.
 
Morning came much too soon and it brought along a friend named Margarita Hangover, and a tiny ad.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic