Mysql 3306端口無法被遠程機器訪問

今天嘗試從linux下安裝Mysql數(shù)據(jù)庫,需要遠程測試時發(fā)現(xiàn)3306端口無法被遠程機器訪問。一開始以為是linux防火墻對于3306端口做了限制,但是關(guān)閉防火墻后發(fā)現(xiàn)也無法進行telnet。
經(jīng)查詢相關(guān)資料發(fā)現(xiàn),mysql默認對于本地連接做了綁定,如果需要遠程機器訪問,則需要修改相關(guān)規(guī)則
具體如下

1.找到如下文件

/etc/mysql/mysql.conf.d/mysqld.cnf

2.打開該文件,顯示

# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License, version 2.0, for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA

#
# The MySQL  Server configuration file.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

[mysqld]
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
datadir         = /var/lib/mysql
log-error       = /var/log/mysql/error.log
# By default we only accept connections from localhost
bind-address  = 127.0.0.1
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

3.找到 bind-address 項
注釋該項或者添加指定訪問遠程機

# bind-address  = 127.0.0.1
bind-address=127.0.0.1  xx.xx.xx.xx
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

友情鏈接更多精彩內(nèi)容