mysql 開放外網訪問許可權的方法

2022-09-25 13:18:07 字數 912 閱讀 8803

如下所示:

主要執行授權命令:

兩種方式

1. 允許任意主機以使用者bd和密碼bdpw連線到local伺服器

mysql> grant all privileges on *.* to 'bd'@'%' identified y 'bdpw' with grant option;

mysql> flush privileges;

2. 允許特定的ip位址以使用者bd和密碼bdpw連線到local伺服器

mysql> grant all privileges on *.* to 'bd'@'172.16.4.198' dentified by 'bdpw' with grant option;xahro

mysql> flush privixahroleges;

注xahro意:

1. 在command line client輸入密碼 或 進入nivacat的命令列介面,

2. 輸入:use m

3. 查詢host輸入: select user,host from user;

如果有host值為%的,則直接執行授權語句;如果沒有,則執行第4步

4. 建立host

如果沒有」%」這個host值,選擇某個開放出去的使用者(bd),執行

mysql> update user set host='%' where user='bd';

mysql> flush privileges;

5. 授權使用者*.* 表明授權所有許可權

mysql> grant all pr on *.* to 'bd'@'%' identified by 'bdpw' with grant option;

mysql> flush privileges;

本文標題: mysql 開放外網訪問許可權的方法

本文位址:

mysql新增新使用者 開放外網訪問

首先建立乙個資料庫 we data 如果已有資料庫,不需要此操作 mysql create database we data 授權frady使用者擁有we data資料庫的所有許可權,但只能在本地訪問。grant all privileges on we data.to frady localhos...

Linux下MySql開放訪問許可權

在linux下安裝完資料庫後,區域網內無法訪問。設定方法 1.停止mysql,進入 etc mysql 編輯my.cnf,找到bind address的配置,改為0.0.0.0,然後啟動mysql 2.登入mysql,進入mysql資料庫,執行update user set host where h...

mysql 外網訪問

vi etc mysql my.cnf 遮蔽bind address,預設是開啟的 instead of skip networking the default is now to listen only on localhost which is more compatible and isnot...