In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to create users and empowerment in Mysql8". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to create users and empowerment in Mysql8".
1. Enter mysqlmysql-uroot-p2 and create a user create user 'testuser1'@'%' identified by' 123456'.
This means to create a user testuser1 that does not restrict ip login
The user's password is 123456.
% means no restrictions on ip login
Refresh permissions, refresh each time the permissions are changed
Flush privileges
If you create a new connection locally, you can log in to the user.
At this time, you will find that there is only one database called information_schema.
3. Empower users to grant all privileges on test_grant.* to 'testuser1'@'%' with grant option
This means that user testuser1 is given all permissions for all tables in the database test_grant (this is the database I created earlier)
With grant option indicates that the user can give rights to other users, but cannot exceed the permissions of that user.
At this point, you can see that the user testuser1 has an extra test_grant database.
The all privileges here can be replaced with select,insert,update,delete,drop,create and so on.
4. View user permissions show grants for 'testuser1'@'%'
5. Revoke the user's rights revoke all privileges on test_grant.* from 'testuser1'@'%'
This means to revoke all operation rights of user testuser1 to database test_grant
Note: if you write this here, you will find that you still have the database test_grant (but you can no longer manipulate the database), this is because I used with grant option when I created it, because all privileges is all permissions except with grant option
Execute the following statement to retrieve all the permissions of the user
Revoke all privileges,grant option from 'testuser1'@'%';6, delete user drop user' testuser1'@'%';7, query all users and their permissions SELECT DISTINCT CONCAT ('User:'', user,'''@''',host,''';') AS query FROM mysql.user
You can do that, too.
SELECT User, Host FROM mysql.user; attached: view user permissions show grants for'# userName'@'#host'
# userName stands for user name
# host represents access rights, as follows
% represents all host address permissions (remotely accessible)
Localhost is local (not remotely accessible)
Specify special Ip access rights such as 10.138.106.102
? What this dog wants to check is testUser.
Show grants for 'testUser'@'%'
Thank you for your reading, the above is the content of "how to create users and empowerment of Mysql8". After the study of this article, I believe you have a deeper understanding of how to create users and empowerment of Mysql8, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.