mysql建立用戶分配權限

version:6.7.6+mysql

一、建立用戶:sql

      create user username identified by 'myPassword';ide

      或對象

      create user  'test'@'127.0.0.1' ;ip

二、修改密碼:io

      alter user test identified by 'test';test

三、設置權限date

      grant all privileges on mydb.* to 'test'@'%' identified by 'test';file

      給 mydb 庫 * (全部對象) all (全部權限),設置密碼‘test’,‘%’ 匹配全部ipselect

   privileges 表明權限select,insert,update,delete,create,drop,index,alter,grant,references,reload,shutdown,process,file等14個權限
     例子:mysql>grant select,insert,update,delete,create,drop on test.hr to test@127.0.0.1 identified by '123'; 

     設置 增、刪、改、查、刪表權限給  test@127.0.0.1 

四、保存,退出。

      flush privileges; \q;

相關文章
相關標籤/搜索