dos界面下:
退出:exit
create user 'testone'@'localhost'identified by'test';
mysql -u testone -p
grant select on school.*to 'test'@'localhost';
刷新:flush privileges;
insert into mysql.user(host,user,password)values('localhost','testtwo',password('test'));
insert into mysql.db(host,db,user,select_priv)value('localhost','school','testtwo','y');
mysql -u testtwo -p
drop user 'testone'@'localhost';
grant select on school.*to 'testthree'@'localhost'identified by 'test';
修改密码:update mysql.user set password=password('one')where user='testtwo'and host='localhost';
收回权限:revoke select on school.*from 'testtwo'@'localhost';
select db,user,host,select_priv from mysql.db;
mysql -u root -p
备份:mysqldump -u root -p school>school.sql
mysql -u root -p
create database newschool;
use newschool;
还原:source school.sql;
show tables;
select *from tstudent;