In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Query all users
Method 1:
Mysql > select host, user, password from mysql.user;-before version 5.7mysql > select host, user, authentication_string from mysql.user;-after version 5.7, including
Mode 2:
Mysql > select distinct concat ('User:'', user,'''@''',host,''';') as query from mysql.user
Query user permissions
All indicates all permissions
Select means to check permissions only.
Update means to change permissions only.
Delete means to delete only permissions and so on.
Method 1:
Mysql > show grants for "user" @ "host"; mysql > show grants for "root" @ "localhost"
Mode 2:
Mysql > select * from mysql.user where user='root'\ G
Add authorized users (newly created users, who do not have any permissions by default): log in to the database using the root user
The format of the command is as follows:
Mysql > create user "username" @ "IP address" identified by "password"; mysql > create user "haidon" identified by "123456";-in this case, the password is 123456 and the host value is%. Mysql > create user "haidon" @ "%" identified by "123456";-- password 123456 in this case
Assign user permissions (authorize users)
The format of the command is as follows:
Mysql > grant permission type on database name. Table name to 'username' @'ip address' identified by 'user password' with grant option
The following types of permissions are commonly used:
All privileges: all permissions.
Select: read permission.
Create: create permissions.
Delete: delete permissions.
Update: update permissions.
Drop: delete database and data table permissions.
Allow access to all tables under all databases
Mysql > grant all privileges on *. * to 'username' @ 'specify ip' identified by' user password'
Allow access to all tables under the specified database
Mysql > grant all privileges on test.* to 'username' @ 'specify ip' identified by' user password'
Allow access to the specified table under the specified database
Mysql > grant all privileges on test.test to 'username' @ 'specify ip' identified by' user password'; mysql > grant all privileges on tornado.* to 'haidon'@'%' identified by' 123456'
Revoke user rights (using root user actions)
Mysql > revoke select on tornado.* from "haidon" @ "%"; mysql > revoke all on tornado.* from "haidon" @ "%"
Delete authorized user
Mysql > drop user "haidon" @ "%";-- delete method 1mysql > delete from mysql.user where user= "haidon";-- delete method 2
Refresh permissions
Mysql > flush privileges
These are the details of adding users and authorizing users in the mysql implementation. For more information, please follow other related articles!
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.