Connecting to a MySQL Server on a Remote PC in LAN
You have encountered an issue while attempting to connect to a MySQL database hosted on another computer within your local network. Despite having MySQL installed on your client computer, the connection is failing.
To establish the connection, consider the following steps:
Resolving Unknown Host Error:
You previously executed the command:
mysql -u user -h 192.168.1.28:3306 -p password
However, the port number (3306) should be included after the database address:
mysql -u user -h 192.168.1.28 -p password
Resolving Access Denied Error:
You have successfully connected without specifying the port, but now encounter an access denied error. To resolve this, grant access privileges to the remote computer.
On the server machine where MySQL is running:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.28' IDENTIFIED BY 'root_password';
FLUSH PRIVILEGES;
Additional Notes:
以上是如何連接區域網路內遠端PC上的MySQL伺服器?的詳細內容。更多資訊請關注PHP中文網其他相關文章!