MySQL 設定允許遠程登入

來源:互聯網
上載者:User

1、修改資料表

可能是你的帳號不允許從遠程登陸,只能在localhost。這個時候只要在 localhost 的那台電腦,登入MySQL後,更改 “MySQL” 資料庫裡的 “user” 表裡的 “Host” 項,從“localhost”改稱“%”,%表示所有機器都允許。

mysql> use mysql 

mysql> update user set Host='%' where User='root'; 

2、授權許可權

允許任何主機使用“myuser”帳號和“mypwd”密碼串連到 MySQL 伺服器。

mysql> GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypwd' WITH GRANT OPTION; 

即可生效。

mysql> FLUSH PRIVILEGES; 

通過以上兩步走就可以了。

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.