局域網其他電腦連接測試機MySQL數據庫

mysql -u root -p

然後回車鍵入密碼!

1.2 賦予主機B操作數據庫的權限

mysql> grant usage on *.* to [email protected] identified by 'password';

說明:賦予[email protected] 使用所有數據庫的權限,在主機192.168.0.1上使用username賬戶登錄,密碼爲:password

mysql> grant usage on *.* to username identified by 'password';

說明:賦予username使用所有數據庫的權限,在所有主機上使用username賬戶登錄,密碼爲:password

mysql> grant all privileges on newdb.* to [email protected];

說明:賦予[email protected] 操作數據庫newdb的最高權限,在主機192.168.0.1上使用username賬戶登錄,無密碼

舉例:

mysql> grant all privileges on *.* to [email protected] identified by '123456' ;

說明:賦予[email protected] 使用所有數據庫的權限,在主機192.168.0.1上使用root賬戶登錄,密碼爲:123456

2、移除賬號

mysql> drop user [email protected];

說明:移除賬戶root,這樣,主機192.168.0.1就不再可以使用root用戶操作服務器A上的數據庫

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章