Granting MySQL Permissions and Deleting them

Granting permissions in MySQL, localhost and external hosts must be separately run, the % sign means any external host and will not account for local connections:

GRANT ALL PRIVILEGES ON *.* TO root@"localhost" IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY 'password';
FLUSH PRIVILEGES;

But say you wanted to then remove remote access, but leave local access, easy (with this being the actual part I learned.  I wanted to write both granting and denying down.):

DELETE FROM mysql.user WHERE User = 'root' AND Host = '%';
FLUSH PRIVILEGES;

 


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *