mysql 新建使用者及授權

2021-06-21 20:46:22 字數 849 閱讀 9321

the create user command:

mysql> create

user yy identified 

by'123';

yy表示你要建立的使用者名稱,後面的123表示密碼

上面建立的使用者可以在任何地方登陸。

如果要限制在固定位址登陸,比如localhost 登陸:

mysql> create

user

yy@localhost identified 

by'123';

grant:

mysql> grant

allprivileges

on*.

*touser;@

local

host

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;

mysql新建使用者及授權

mysql新建使用者和授權的方法總是記不住,在此記下來 建立使用者create user username host identified by password 使用者授權grant all on databasename.tablename to username hostname identi...

mysql新建並授權使用者

登入mysql mysql u root p 密碼 建立使用者 mysql insert into mysql user host,user,password values localhost phplamp password 1234 重新整理系統許可權表 mysql flush privileg...

mysql新建使用者 授權 刪除

1.檢視使用者 檢視使用者並沒有直接的sql語句,而是進入 mysql資料庫的user表 這個mysql庫和user表都是一開始就有的 直接用 select from user 來檢視有什麼使用者 由於在linux下比較難看,因為格式比較亂,所以我用了 sqlyog這個軟體登陸資料庫來操作。如下 效...