資料庫遠端訪問許可權設定

2021-08-15 11:57:51 字數 678 閱讀 9690

總結2種方法:

第一種:

1.登陸資料庫 #  use mysql;

2.更新遠端連線資料 # update user set host = '%' where user = 'root';(

%為所有ip都可以遠端訪問

) 或直接增加一條 資料 # 

insert into user (host,user,password) values('192.168.0.51','root',password('123'));

3.檢視更改 #  

select host, user from user;

4.推送設定到伺服器 # 

flush privileges

第二種:

#grant all privileges on *.* to 'myuser'@'%'identified by 'mypassword' with grant option; 

//如果是固定ip就這麼寫

#grant all privileges on *.* to 'root'@'192.168.0.49'identified by '123' with grant option;

//推送設定到記憶體或重啟伺服器也行

mysql>flush privileges

MySQL資料庫設定遠端訪問許可權

1 設定使用者名為root,密碼為空,可訪問資料庫test grant all privileges on test.to root 2 設定使用者名為root,密碼為空,可訪問所有資料庫 grant all privileges on to root 3 設定指定使用者名為liuhui,密碼為空,...

MySQL資料庫設定遠端訪問許可權方法總結

1,設定訪問單個資料庫許可權 如下 複製 mysql grant all privileges on test.to root 說明 設定使用者名為root,密碼為空,可訪問資料庫test 2,設定訪問全部資料庫許可權 如下 複製 mysql grant all privileges on to r...

MySQL資料庫設定遠端訪問許可權方法總結

1,設定訪問單個資料庫許可權 mysql grant all privileges on test.to root 說明 設定使用者名為root,密碼為空,可訪問資料庫test 2,設定訪問全部資料庫許可權 mysql grant all privileges on to root 說明 設定使用者...