语法: grant all privileges on *.* to joe@localhost identified by '1';
flush privileges;
take joe 1 login
Attached:
MySQL > grant permission 1, permission 2, ... permission n on database name. Table name to username@user address identified by 'connection password';
permission 1, permission 2, ... permission n represents select, insert, update, delete, create ,drop,index,alter,grant,references,reload,shutdown,process,file and other 14 permissions.
When permission 1, permission 2, ... permission n are replaced by all privileges or all, it means that all permissions are granted to the user.
When the database name and table name are replaced by *.*, it means that the user is authorized to operate all tables in all databases on the server.
The user address can be localhost, or it can be an ip address, a machine name, or a domain name. You can also use '%' to connect from any address.
'Connection password' cannot be empty, otherwise the creation fails.
mysql> grant select, insert, update, delete, create, drop on vtdc.employee to [email protected] identified by '123';
assign user joe from 10.163.225.87 to select and insert the employee table of database vtdc ,update,delete,create,drop and other operations permissions, and set the password to 123.
mysql> grant all privileges on vtdc.* to [email protected] identified by '123';
assign the user joe from 10.163.225.87 the authority to perform all operations on all tables in the database vtdc, and set the password to 123.
mysql> grant all privileges on *.* to [email protected] identified by '123';
assign the user joe from 10.163.225.87 the authority to perform all operations on all tables in all databases, and set the password to 123.
mysql> grant all privileges on *.* to joe@localhost identified by '123';
assign the local user joe the authority to perform all operations on all tables in all databases, and set the password to 123.
reprint
http://blog.csdn.net/wengyupeng/article/details/3290415