例如:
mysql>grant select,insert,update,delete,create,drop on vtdc.employee to tanzuai@10.163.225.87 identified by ‘123′;
给来自10.163.225.87的用户tanzuai分配可对数据库vtdc的employee表进行select,insert,update,delete,create,drop等操作的权限,并设定口令为123。
mysql>grant all on vtdc.* to tanzuai@10.10.10.87 identified by ‘123′;
给来自10.163.225.87的用户tanzuai分配可对数据库vtdc所有表进行所有操作的权限,并设定口令为123。
mysql>grant all on *.* to tanzuai@10.10.10.87 identified by ‘123′;
给来自10.163.225.87的用户tanzuai分配可对所有数据库的所有表进行所有操作的权限,并设定口令为123。
mysql>grant all privileges on *.* to tanzuai@localhost identified by ‘123′;
给本机用户tanzuai分配可对所有数据库的所有表进行所有操作的权限,并设定口令为123。
3.删除用户
@>mysql -u root -p
@>密码
mysql>DELETE FROM user WHERE User=”jeecn” and Host=”localhost”;
mysql>flush privileges;
//删除用户的数据库
mysql>drop database tanzuaidb;
4.修改指定用户密码
@>mysql -u root -p
@>密码
mysql>update mysql.user set password=password(‘新密码’) where User=”tanzuai” and Host=”localhost”;
mysql>flush privileges;
mysql>quit;
5.建表
create table receive_user
(
waybillno varchar(20) not null check(waybillno!=‘‘),
model varchar(20) not null,
userid varchar(20) not null,
create_time datetime default null,
primary key(waybillno)
)engine=InnoDB default charset=utf8 auto_increment=1;