localhost is just an alias for loopback address 127.0.0.1, which means this computer.
If you want to communicate with this computer from another place, you will need to use its real IP address.
For example, see the following “diagram” showing where the connections will go, depending on the IP address used:
+-----------+ 10.1.1.8 +-----------+
| MyPC | <------- | YourPC |
| | | |
| 10.1.1.8 | -------> | 10.1.1.9 |
+-----------+ 10.1.1.9 +-----------+
| ^ | ^
| | | |
127.0.0.1-+ 127.0.0.1-+
Windows IP- ipconfig (ifconfig UNIX-) , localhost.
, IP- , , ( 10.1.1.8):
GRANT ALL PRIVILEGES ON *.* TO 'mysql'@'10.1.1.8' IDENTIFIED BY 'super-sekrit'