Mysql 二 開啟遠端連線篇

2021-08-17 01:35:29 字數 682 閱讀 8049

在linux登入到mysql資料:

mysql -uroot -p

輸入密碼

切換到mysql資料庫

mysql>

use mysql

輸入grant all privileges on *.* to root@"%" identified by "密碼";

mysql> grant all privileges on *.* to root@"%" identified by "563412";

grant all privileges on *.* to root@"%" identified by "root!123456";

這表示是給本地ip賦予了所有的許可權,包括遠端訪問許可權,%百分號表示允許任ip訪問資料庫。

然後再輸入

mysql>

flush privileges;

mysql>

exit

然後,重啟資料庫

service mysql restart 注:重啟服務的命令有的是service,有的是systemctl,我不知道是linux版本不一樣,還是針對不同的服務,命令也不一樣,這個注意一下

防火牆也要關了,

service iptables stop

或者systemctl stop firewalld.service

然後就可以了啦

mysql開啟遠端 mysql 開啟遠端連線

1045,access denied for user root 192.168.100.1 using password yes 開啟資料庫遠端連線即可 1 先在本機使用root使用者登入mysql,然後進行授權。mysql grant all privileges on to root iden...

開啟mysql遠端連線

首先新增使用者 當然也可是使用root使用者 格式 grant 許可權 on 資料庫名.表名 使用者 登入主機 identified by 使用者密碼 grant select,update,insert,delete on to zhxia identified by 123456 或者所有許可權...

開啟mysql遠端連線

在mysql控制台執行 grant all privileges on to root identified by mypassword with grant option 在mysql控制台執行命令中的 root 可以這樣理解 root是使用者名稱,是主機名或ip位址,這裡的 代表任意主機或ip位...