在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";
這表示是給本地ip賦予了所有的權限,包括遠程訪問權限,%百分號表示允許任ip訪問數據庫。
然后再輸入
mysql> flush privileges;
重新加載,,并退出
mysql>exit
然后,重啟數據庫
service mysql restart 注:重啟服務的命令有的是service,有的是systemctl,我不知道是Linux版本不一樣,還是針對不同的服務,命令也不一樣,這個注意一下
防火墻也要關了,service iptables stop 或者 systemctl stop firewalld.service
然后就可以了啦
新聞熱點
疑難解答