A rights management
We know that our highest authority administrator is the root user, it has the highest level operations. Including select, update, delete, update, grant and other operations. Then the general DBA engineers created after the company and a user password, let you to connect to the database operations, and to the current user to set a permission (or all privileges) operations. So then we need to take a brief look:
How to create a user and password
to the current user authorization
to remove the current user's permission
if you want to create a new user, you need the following:
1. Go to the next database mysql
mysql> use mysql
Database changed
2. For a new user additions and deletions
Copy the code
1. Create a user:
Specify the ip: 192.118.1.1 of chao user login
create user 'chao'@'192.118.1.1' identified by '123';
Specify the ip:. 192.118.1 beginning of chao user login
create user 'chao'@'192.118.1.%' identified by '123';
Specify any user to log ip of chao
create user 'chao'@'%' identified by '123';
2. Delete the user
drop user 'username' @ 'IP address';
3. Modify the user
rename user 'username' @ 'IP address' to 'new user name' @ 'IP address';
4. Change password
set password for 'username' @ 'IP address' = Password ( 'new password');
duplicated code
3. The current user authorization management
Copy the code
View Permissions
show grants for 'user' @ 'IP address'
Chao only authorized users have db1.t1 file query, insert and update operations
grant select ,insert,update on db1.t1 to "chao"@'%';
All expressed permission, in addition to grant this command, which is the root ago. chao any user operation on the file t1 db1
grant all privileges on db1.t1 to "chao"@'%';
chao user to perform any operation on the db1 database files
grant all privileges on db1.* to "chao"@'%';
chao user has any operation on all database files
grant all privileges on . to "chao"@'%';
Cancellation rights
Cancel any action chao t1 user files on the db1
revoke all on db1.t1 from 'chao'@"%";
Cancel chao user from a remote server db1 all rights to the database of all the tables
revoke all on db1.* from 'chao'@"%";
Cancel chao user from a remote server all database permissions for all tables
REVOKE All privileges ON . From 'chao' @ '%';
copy the code
ps: in the company, under normal circumstances is DBA engineers to do these authorizations. Give you a user name and password, you will be able to connect.