# MY SQL開啟遠端連接 1.進入MySQL終端機頁面 預設路徑: cd C:\Program Files\MySQL\MySQL Server 8.0\bin 2.登入MySQL mysql -u root -p 輸入密碼 3.選擇 mysql 資料庫 use mysql; 4.確認Host (預設為locahost) select host,user,authentication_string,plugin from user;  5.建立使用者(版本0.8之後root不可直接動用GRANT修改,需要先創建帳號) CREATE USER 'user name'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; 6.授權root使用者的所有許可權並設定遠端訪問 GRANT ALL ON *.* TO 'root'@'%'; FLUSH PRIVILEGES; 7.再次確認Host (host為%時就是成功) select host,user,authentication_string,plugin from user;  8.虛擬機連接本機資料庫 確認本機VMware Network Adapter VMnet1 的ipv4 cmd ipconfig  虛擬機終端機輸入 (xxx.xxx.xxx.xxx為VMnet1 的ipv4 ip) mysql -h xxx.xxx.xxx.xxx -P 3306 -u root -p; 輸入密碼  ------------------------------ 參考資料 https://www.gushiciku.cn/pl/gJa0/zh-tw https://www.itread01.com/articles/1486995588.html https://www.796t.com/article.php?id=159979 https://stackoverflow.com/questions/50177216/how-to-grant-all-privileges-to-root-user-in-mysql-8-0
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up