1. 程式人生 > >mysql遠端登入(授權與撤銷授權)

mysql遠端登入(授權與撤銷授權)

一、遠端登入授權:GRANT
1.登入musql

mysql -u root -r

2.輸入密碼登陸之後授權:

mysql> GRANT ALL PRIVILEGES ON *.* TO'root'@'%' IDENTIFIED BY 'xxxxxx' WITH GRANT OPTION;

注:XXXXXX為mysql的root賬戶密碼

3.刷新系統許可權:

mysql> flush privileges;

二、撤銷授權:REVOKE
revoke 跟 grant 的語法差不多,只需要把關鍵字 “to” 換成 “from” 即可:

grant  all on
*.* to [email protected]; revoke all on *.* from [email protected];