#登录数据库
mysql -u root -p
一、改表法
在localhost登入mysql后,更改 “mysql” 数据库里的 “user” 表里的 “host” 项,将"localhost"改称"%"
update user set host = '%' where mysql.user = 'root';
GRANT ALL ON *.* TO admin@'%' IDENTIFIED BY 'admin' WITH GRANT OPTION;
flush privileges;
select user,host from mysql.user;