Linux下mysql新建账号及权限设置
原文鏈接:Linux下mysql權(quán)限配置及賬號創(chuàng)建
?
1、權(quán)限賦予
說明:mysql部署在服務(wù)器A上,內(nèi)網(wǎng)上主機B通過客戶端工具連接服務(wù)器A以進行數(shù)據(jù)庫操作,需要服務(wù)器A賦予主機B操作mysql的權(quán)限
1.1 在服務(wù)器A上進入mysql,假設(shè)在服務(wù)器A上mysql的賬戶是root:
mysql -u root -p然后回車鍵入密碼!
1.2 賦予主機B操作數(shù)據(jù)庫的權(quán)限
mysql> grant usage on *.* to username@192.168.0.1 identified by 'password';說明:賦予username@192.168.0.1?使用所有數(shù)據(jù)庫的權(quán)限,在主機192.168.0.1上使用username賬戶登錄,密碼為:password
?
mysql> grant usage on *.* to username identified by 'password';說明:賦予username使用所有數(shù)據(jù)庫的權(quán)限,在所有主機上使用username賬戶登錄,密碼為:password
也可寫成
mysql> grant usage on *.* to 'username'@'%' identified by 'password';?
mysql> grant all privileges on newdb.* to username@192.168.0.1;說明:賦予username@192.168.0.1 操作數(shù)據(jù)庫newdb的最高權(quán)限,在主機192.168.0.1上使用username賬戶登錄,無密碼
舉例:
mysql> grant all privileges on *.* to root@192.168.0.1 identified by '123456' ;說明:賦予root@192.168.0.1?使用所有數(shù)據(jù)庫的權(quán)限,在主機192.168.0.1上使用root賬戶登錄,密碼為:123456
2、移除賬號
mysql> drop user root@192.168.0.1;說明:移除賬戶root,這樣,主機192.168.0.1就不再可以使用root用戶操作服務(wù)器A上的數(shù)據(jù)庫
轉(zhuǎn)載于:https://www.cnblogs.com/eczhou/archive/2012/07/12/2588187.html
總結(jié)
以上是生活随笔為你收集整理的Linux下mysql新建账号及权限设置的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 写最少的代码
- 下一篇: Win 2008 R2安装SQL Ser