創建用戶並分配權限;
復制代碼 代碼如下:
insert into mysql.user(Host,User,Password) values("localhost","phplamp",password("1234"));//創建用戶
grant all privileges on dbname.* to 'username'@'%' identified by 'password';//創建用戶並分配所有權限
grant select,update on phplampDB.* to phplamp@localhost identified by '1234';//創建用戶並分配權限
update mysql.user set password=password('新密碼') where User="phplamp" and Host="localhost";//修改用戶密碼
--刪除用戶指定權限
revoke insert,update,delete,select ON *.* from 'xbb'@'localhost' IDENTIFIED BY '123';