To grant root access from all hosts (except for localhost):
GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY 'topsecret';
To revoke root access from all hosts (except for localhost):
DELETE FROM mysql.user WHERE User = 'root' AND Host = '%'; FLUSH PRIVILEGES;
To enable MySQL service to accept connections from all hosts change the following line in file mysql.conf:
or better just comment out:
and restart the MySQL service.
*) The percent symbol (
"%") in the notation
root@"%" means “any host”, but it doesn’t imply localhost. You need to repeat the commands above with
root@localhost in order to grant/revoke permissions for localhost.