mysql如何開啟遠端訪問

2021-06-22 00:39:39 字數 890 閱讀 6723

1、確定伺服器上的防火牆沒有阻止 3306 埠。

mysql 預設的埠是 3306 ,需要確定防火牆沒有阻止 3306 埠,否則遠端是無法通過 3306 埠連線到 mysql 的。

如果您在安裝 mysql 時指定了其他埠,請在防火牆中開啟您指定的 mysql 使用的埠號。

2、增加允許遠端連線 mysql 。

方法一:授權法

mysql 

-uroot 

-p123456

grant all privileges on discuz

.* to ted

@'123.123.123.123' 

identified by 

'123456';

grant all privileges on *.*

to ted

@'123.123.123.123' 

identified by 

'123456'

;grant all privileges on *.*

to ted

@'%' 

identified by 

'123456';

flush privileges

;  讓許可權立即生效

點代表整個庫,discuz.*代表discuz庫的所有表,%代表任何位址

方法二:改表法

mysql -u root -pvmware

mysql> use mysql;

mysql> update user set host = 『%』 where user = 『root』;  

mysql> select host, user from user;

mysql> flush privileges;

mysql如何開啟遠端訪問?

mysql u root p welcome to the mysql monitor.commands end with or g.your mysql connection id is 6 server version 5.6.23 log source distribution copyrig...

mysql 開啟遠端訪問 遠端訪問

select host,user,password from user 查詢使用者遠端訪問相關資訊 用root使用者登陸,然後 grant all privileges on to 建立的使用者名稱 identified by 密碼 flush privileges 重新整理剛才的內容 格式 gra...

MySQL 開啟遠端訪問

登入mysql mysql u root p 輸入密碼建立賬號 mysql use mysql mysql create user remote user identified by password 表示可以接受從任意ip的主機訪問,也可以寫成固定ip,這樣就只能從這個ip的機子訪問。為這個賬號賦...