MySQL建立資料庫與建立使用者以及授權

來源:互聯網
上載者:User

標籤:字元   --   sch   mysql   schema   htm   roo   字母   個數   

 

1、create schema [資料庫名稱] default character set utf8 collate utf8_general_ci;--建立資料庫

  採用create schema和create database建立資料庫的效果一樣。

2、create user ‘[使用者名稱稱]‘@‘%‘ identified by ‘[使用者密碼]‘;--建立使用者

  密碼8位以上,包括:大寫字母、小寫字母、數字、特殊字元

  %:匹配所有主機,該地方還可以設定成‘localhost’,代表只能本地訪問,例如root賬戶預設為‘localhost‘

3、grant select,insert,update,delete,create on [資料庫名稱].* to [使用者名稱稱];--使用者授權資料庫

  *代表整個資料庫

4、flush  privileges ;--立即啟用修改

5、revoke all on *.* from tester;--取消使用者所有資料庫(表)的所有許可權

6、delete from mysql.user where user=‘tester‘;--刪除使用者

7、drop database [schema名稱|資料庫名稱];--刪除資料庫

MySQL建立資料庫與建立使用者以及授權

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.