1. How to create a user and password 1. Enter the mysql database mysql> use mysql Database changed 2. Add, delete, and modify new users 1. Create a user # Specify the IP address: 192.118.1.1 as user chao to log in create user 'chao'@'192.118.1.1' identified by '123'; #Specify the IP address: 192.118.1. Chao user login create user 'chao'@'192.118.1.%' identified by '123'; # Specify any ip user chao to log in create user 'chao'@'%' identified by '123'; 2. Delete User drop user 'username'@'IP address'; 3. Modify user rename user 'username'@'IP address' to 'new username'@'IP address'; 4. Change password set password for 'user name'@'IP address'=Password('new password'); 2. Authorize the current user #View permissions show grants for 'user'@'IP address' #Authorize user chao to query, insert, and update only the db1.t1 file grant select ,insert,update on db1.t1 to "chao"@'%'; #Authorize the Chao user to query only the db1 file grant select on db1.* to "chao"@'%'; # Indicates all permissions, except for the grant command, which is only available to root. User chao has any operation on the t1 file under db1. grant all privileges on db1.t1 to "chao"@'%'; #The chao user can perform any operation on the files in the db1 database. grant all privileges on db1.* to "chao"@'%'; #chao user has any operation on all files in the database grant all privileges on *.* to "chao"@'%'; 3. Remove the current user's permissions #Revoke permissions #Revoke any operation of user Chao on the t1 file of db1 revoke all on db1.t1 from 'chao'@"%"; # Revoke all permissions of the Chao user from the remote server on all tables in database db1 revoke all on db1.* from 'chao'@"%"; Revoke all privileges on *.* from 'chao'@'%'; The above is the details of how to create users and permission management in MySQL. For more information about creating users and permission management in MySQL, please pay attention to other related articles on 123WORDPRESS.COM! You may also be interested in:
|
<<: How to use the yum command
>>: Detailed explanation of webpack-dev-server core concepts and cases
Table of contents 1. Constructor and instantiatio...
The following functions are implemented: 1. Usern...
Table of contents 1. Short circuit judgment 2. Op...
Click here to return to the 123WORDPRESS.COM HTML ...
Background: During the development process, we of...
500 (Internal Server Error) The server encountere...
1. Cancel the dotted box when the button is press...
You may often see some HTML with data attributes. ...
Deployment environment: Installation version red ...
Table of contents 1. Introduction: 2. Docker: 1 C...
Table of contents 1. Basic overview of the proces...
Table of contents Preface 1. Uninstall MySQL 2. I...
Today I sent a small tool for Ubuntu to a custome...
Table of contents Problems encountered during dev...
We, humble coders, still have to sing, "You ...