Changing host permissions for MySQL users
If you've got access to the mysql
database, you can change the grant tables directly:
UPDATE mysql.user SET Host='%' WHERE Host='localhost' AND User='username';
...and an analogous UPDATE
-statement to change it back.
Also you might need to make changes to the mysql.db
table as well:
UPDATE mysql.db SET Host='%' WHERE Host='localhost' AND User='username';
and then flush to apply the privileges:
FLUSH PRIVILEGES;
Best answer on Stackoverflow suggesting to use RENAME USER
which copy the user privileges.
Using Data Control Language (statements as GRANT, REVOKE, RENAME and so on) does not require FLUSH PRIVILEGES;
and is required in architecture like Galera or Group Replication in MySQL versions having MyISAM tables in mysql
database because MyISAM tables are not replicated.