In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains the "MySQL user management commands commonly used", the content of the explanation is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "what are the common MySQL user management commands" bar!
Add user
Log in to the database as root, and run the following command:
Create user zhangsan identified by 'zhangsan'
The above command creates the user zhangsan with a password of zhangsan. You can view the information of the new users in the mysql.user table:
Authorization
Command format: grant privilegesCode on dbName.tableName to username@host identified by "password"
Grant all privileges on zhangsanDb.* to zhangsan@'%' identified by 'zhangsan';flush privileges
The above statement authorizes all operation rights of the zhangsanDb database to the user zhangsan.
You can view the information of the new database permissions in the mysql.db table:
You can also view the commands that are granted to execute through the show grants command:
Show grants for 'zhangsan'
PrivilegesCode indicates the type of permission granted. The following types are commonly used [1]:
All privileges: all permissions.
Select: read permission.
Delete: delete permissions.
Update: update permissions.
Create: create permissions.
Drop: delete database and data table permissions.
DbName.tableName represents a specific library or table that grants permissions. The following options are commonly used:
.: grant permissions to all databases on this database server.
DbName.*: grants permissions to all tables in the dbName database.
DbName.dbTable: Grant permissions to the dbTable table in the database dbName.
Username@host represents the granted user and the IP address that the user is allowed to log on to. There are several types of Host:
Localhost: only this user is allowed to log in locally, not remotely.
%: allow remote login on any machine other than this machine.
192.168.52.32: a specific IP indicates that only this user is allowed to log in from a specific IP.
Password specifies the face when the user logs in.
Flush privileges means refresh permission change.
The article was first posted in [blog Garden-Chen Shuyi]. Please respect the original and retain the original link. Modify the password
Run the following command to change the user's password
Update mysql.user set password = password ('zhangsannew') where user =' zhangsan' and host ='%'; flush privileges; deletes the user
Run the following command to delete the user:
Drop user zhangsan@'%'
The drop user command deletes the user and the corresponding permissions, and after executing the command, you will find that the corresponding records of the mysql.user table and the mysql.db table have disappeared.
Common command group
Create users and grant full permissions to the specified database: applicable to Web applications to create MySQL users
Create user zhangsan identified by 'zhangsan';grant all privileges on zhangsanDb.* to zhangsan@'%' identified by' zhangsan';flush privileges
The user zhangsan is created and all permissions for the database zhangsanDB are granted to zhangsan. If you want to enable zhangsan to log in locally, you can give localhost more permissions:
Grant all privileges on zhangsanDb.* to zhangsan@'localhost' identified by 'zhangsan'; thank you for your reading, the above is the content of "what are the commonly used commands for MySQL user management". After the study of this article, I believe you have a deeper understanding of what commands are commonly used in MySQL user management, 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.