Thrys5
Thrys5

Reputation: 71

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.

Upvotes: 1

Views: 73

Answers (1)

Asaph
Asaph

Reputation: 162801

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.

Upvotes: 2

Related Questions