In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article is to share with you the content of a sample analysis of mysql permission operations. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
1. Create a new user:
Create user mark@localhost identified by '123456'
2. Delete a user:
Drop user mark@localhost
3. Modify the user name:
Rename user mark@localhost to mark1@localhost
4. Modify the user's password:
Set password for mark@localhost = password ('111111')
5. Grant permissions:
(1) Grant table permissions: select,insert,delete,update,references,create,alter,index,drop,all or all privileges.
Use mysql
Grant select on user to mark@localhost
(2) Grant authority: select,insert,delete,update,references,create,alter,index,drop,create temporary tables,create view,show view,create routine,alter routine,execute routine,lock tables,all or all privileges.
Grant select on. * to mark@localhost
(3) Grant user permissions: create user,show databases
Grant create user on *. * to mark@localhost
Grant create,alter,drop on *. * to mark@localhost
6. Transfer and restriction of authority
(1) the addition of with grant option at the end of the grant statement indicates that the user has the right to grant his or her permission to other users, regardless of whether the other users have the right or not.
Grant select on mysql.user to mark@localhost with grant option
After re-logging in to the database with mark, mark can grant other users the same permissions.
(2) the with clause can also impose practical restrictions on a user.
Max_queries_per_hour 1 queries the database 1 times per hour.
Max_connections_per_hour 1 can connect to the database several times per hour.
Max_updates_per_hour 1 can modify the database many times per hour
Max_user_connections 1 the maximum number of users connected to mysql at the same time.
Such as:
Grant select on mysql.user to mark@localhost with max_queries_per_hour 1
7. Reclaim permissions.
Revoke select on mysql.user from mark@localhost
Thank you for reading! This is the end of the article on "sample Analysis of mysql permission Operation". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.