mysql許可權管理及賬戶建立

2021-08-31 16:04:57 字數 779 閱讀 8334

create user '使用者名稱'@'localhost' identified by '密碼';
%代表任意

create user '使用者名稱'@'客戶端ip' identified by '密碼';

create user '使用者名稱'@'%' identified by '密碼';

create user '使用者名稱'@『127.0.0.%』 identified by '密碼';

grant 新增的命令 on 等級 to '使用者名稱'@'localhost';

grant select on *.* to 'demo'@'localhost';

grant select on 資料庫.表名 to '使用者名稱'@'localhost';

grant select on demo.t1 to 'hz'@'localhost';

grant select(字段,字段),updata(字段,字段) on 資料庫.表名 to '使用者名稱'@localhost;

grant select(id,name),updata(id) on demo.t1 to 'demo'@'localhost';

revoke 拿回的命令 on *.* from '使用者名稱'@'localhost';

revoke all in *.* from 'demo'@'localhost';

mysql 賬戶管理 MySQL賬戶管理

登陸 退出mysql伺服器 登陸mysql伺服器時,可以使用mysql命令並在後面指定登陸主機以及使用者名稱和密碼。mysql命令的常用引數如下 h主機名,該引數指定主機名或ip,如果不指定,預設是localhost。u使用者名稱,該引數指定使用者名稱。p密碼,該引數指定登陸密碼。如果該引數後面有欄...

mysql 賬戶 mysql 賬戶管理

mysql增加新使用者賬戶 可以用兩種方式建立mysql賬戶 1.使用grant語句 2.直接操作mysql授權表 最好的方法是使用grant語句,因為這樣更精確,錯誤少。建立超級 使用者 mysql grant all privileges on to monty localhost identi...

MYSQL 賬戶管理

方法 1 mysqladmin u user h host password newpass 方法2 set password for user host password newpass 方法3 set password password newpass 這方方法是更改當前登入賬戶密碼 方法4 直...