Update the host entry of a user in MySQL

First of all find all the users in your database having permissions.

mysql> select user,host from mysql.user;

If you want to see their permissions,

mysql> show grants for 'root'@'localhost';

Now you want to change the host part of a user. You can issue the below command :

mysql> UPDATE mysql.user SET host = 'New_IP' WHERE host = 'Old_IP' AND user = 'user_you_want_to_change';
mysql> flush privileges;

Very easy 🙂

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s