mysql建立使用者及ssc網站搭建

來源:互聯網
上載者:User

標籤:user   操作   串連   create   sel   shutdown   alt   date   mys   

mysql建立使用者的方法分成三種:ssc網站搭建、INSERT USER表的方法、CREATE USER的方法、GRANT的方法。企 娥:217 1793 408
1、通過CREATE USER命令進行建立使用者
指令碼:CREATE USER ‘username‘@‘host‘ [IDENTIFIED BY ‘PASSWORD‘] 其中密碼是可選項;
例子:CREATE USER ‘test‘@‘127.0.0.1‘ IDENTIFIED BY "123";
CREATE USER ‘test‘@‘127.0.0.%‘ IDENTIFIED BY "123";
CREATE USER ‘test‘@‘ %‘ ;
說明:該方法建立出來的使用者只有串連資料庫的許可權,需要後續繼續授權;
2、通過GRANT命令建立使用者
個人習慣一般用這種方法進行建立使用者,當資料庫存在使用者的時候GRANT會對使用者進行授權,但當資料庫不存在該使用者的時候,就會建立
相應的使用者並進行授權。(說明上面那步是多餘的)
指令碼:
GRANT <ALL|priv1,priv2,.....privn> ON [object] [IDENTIFIED BY ‘password‘]
[WITH GRANT OPTION];
MAX_QUERIES_PER_HOUR count
MAX_UPDATES_PER_HOUR count
MAX_CONNECTIONS_PER_HOUR count
MAX_USER_CONNECTIONS count
說明:priv代表許可權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 [email protected] identified by ‘123‘;
說明:給主機為127.0.0.1的使用者test分配可對資料庫test的hr表進行select,insert,update,delete,create,drop等操作的許可權,並設定口令
為123。
mysql>grant all privileges on test. to [email protected] identified by ‘123‘;
說明:給主機為127.0.0.1的使用者test分配可對資料庫test所有表進行所有操作的許可權,並設定口令為123。
mysql>grant all privileges on
. to [email protected] identified by ‘123‘;
說明:給主機為127.0.0.1的使用者test分配可對所有資料庫的所有表進行所有操作的許可權,並設定口令為123。
mysql>grant all privileges on
.* to [email protected] identified by ‘123‘;
說明:使用者test分配可對所有資料庫的所有表進行所有操作的許可權,並設定口令為123。

mysql建立使用者及ssc網站搭建

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.