Linux上mysql開啟遠端鏈結不生效的解決方式

2021-10-08 23:31:03 字數 931 閱讀 5756

第一種情況,或許是伺服器沒有新增3306的規則,這時新增規則,再試試能否鏈結

第二種情況,如依然不能連線,則看看伺服器的防火牆是否開放3306埠。我遇到的情況便是此種。

解決方法:開放3306埠

如果提示錯誤:the program 'firewall-cmd' is currently not installed. you can install it by typing: apt install firewalld  則是你沒有安裝,安裝一次便可。

我的是在ubuntu上面,所以安裝方法為

root@izuf69urlacrut7qqxhcofz:/# apt install firewalld

安裝成功後再次配置3306埠

root@izuf69urlacrut7qqxhcofz:/# firewall-cmd --permanent --add-port=3306/tcp

重新整理規則

然後再次測試鏈結,成功。

linux 開啟mysql遠端

etc mysql my.cnf 修改 bind address 127.0.0.1 為 允許任何機器訪問,也可以設定成固定的ip bind address 0.0.0.0 修改資料庫mysql的user表 update user set host where user username 代表任何位...

centos上mysql開啟遠端訪問

預設linux安裝到centos系統上,其他電腦遠端是不能進行登入的,所有要設定一下才可以。使用命令 mysql grant all privileges on to root identified by 111111 with grant option root 表示使用者名稱,表示所有的電腦都可...

Linux開啟mysql遠端連線

1,首先在命令列 mysql u root p進入mysql命令列 2.在mysql命令列執行命令 grant all privileges on to conn user identified by conn passwd with grant option 該命令作用是,建立乙個使用者名為con...