简体   繁体   中英

Cant Connect to MySQL over network

I'm in the process of setting up a MySQL server. I set up the server as localhost on port 3306. However I want to be able to access this server over the network. The server has a static IP address. How can I change it from localhost to the static IP address?

I already did this suggestion I found online, and it didn't work:

 mysql> GRANT ALL ON *.* to root@'localhost' IDENTIFIED BY 'your-root-password'; 

 mysql> FLUSH PRIVILEGES;

When I try to access it from the server or another PC, I get this error:

Failed to Connect to MySQL at XXXXXX:3306 with user root
HOST 'XXXXXXX' is not allowed to connect to this MySQL server

Thank You.

In addition to the GRANT statement you've already listed above, you also need this one to connect from somewhere other than localhost

GRANT ALL ON *.* to root@'%' IDENTIFIED BY 'your-root-password';

In MySQL land user@somehost is, in practice, a different user than user@some-other-host .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM