mysql指定ip访问

GRANT ALL PRIVILEGES ON *.* TO ‘root’@’localhost’ IDENTIFIED BY ‘password’ WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO ‘root’@’192.168.1.204’ IDENTIFIED BY ‘password’ WITH GRANT OPTION;
flush privileges;

select * from user;

如果是更新
update user set host =’192.168.1.2′ where user = ‘root’ and Host=’localhost’;

Leave a Comment