X

Create new MySQL user and allow them to connect from any IP

If you are getting the error: user is not allowed to connect to this MySQL serverConnection closed by foreign host

Or : Access denied for user ‘root’@’somehost.com’ (using password: YES))

Then you probably have not created your user properly in MySQL
Here is how to create a new MySQL user and give him access to connect to the database from any location (local host or remote host).

Execute the following 4 queries – probably easiest to just run them from within the SQL section of phpMyAdmin (use the same username and password in queries 2 and 4 – these are the username and password you want to give to the new user you are creating)

CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' WITH GRANT OPTION;
CREATE USER 'username'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' WITH GRANT OPTION;

(note, make sure you have told MySQL to listen for connections from all hosts and not just localhost)

test:
Disqus Comments Loading...