1.創建用戶命令:
<!---->mysql> CREATE USER yy IDENTIFIED BY '123';yy表示你要建立的用戶名,後面的123表示密碼
上面建立的用戶可以在任何地方登陸。
如果要限制在固定地址登陸,比如localhost 登陸:
<!---->mysql> CREATE USER yy@localhost IDENTIFIED BY '123';2.授權grant:
<!---->mysql> GRANT ALL PRIVILEGES ON *.* TO user;@localhost <!---->grant select,insert,update,delete on *.* to test1@"%" Identified by "abc";grant select,insert,update,delete on *.* to test1@"%" Identified by "abc";
格式:grant select on 數據庫.* to 用戶名@登錄主機 identified by "密碼"
修改密碼:
<!---->mysql> grant all privileges on pureftpd.* to koko@localhost identified by 'mimi';flush:
<!---->mysql> flush privileges;查看用戶信息:
<!---->mysql> select host,user from mysql.user; 3.刪除用戶。