Home >Database >Mysql Tutorial >Can't Connect to MySQL on Another PC in LAN: What am I Doing Wrong?
Initial Problem:
A user is unable to connect to a MySQL database hosted on another PC within the local network, despite having MySQL installed on the client machine. The error message encountered indicates that the MySQL server host is not recognized.
Solution for Initial Problem:
To successfully connect to the MySQL server on another PC, the following steps are crucial:
mysql -u username -h server_ip -p password
where username is the database user, server_ip is the IP address of the server PC, and password is the user's password.
Subsequent Problem:
After using the correct command, the user encounters an access denied error, citing that the user '@'MACBOOK' is denied access.
Solution for Subsequent Problem:
To grant access to the database from the client PC:
GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' IDENTIFIED BY 'user_password';
FLUSH PRIVILEGES;
The above is the detailed content of Can't Connect to MySQL on Another PC in LAN: What am I Doing Wrong?. For more information, please follow other related articles on the PHP Chinese website!