1. 登录mysql
mysql -u root -p
2. 用户管理
use mysql;
3. 查看用户
select host,user from user;
4. 新建并授权用户
# (*.*是允许远程访问的IP的值, 用户名建议不要使用root, '%'表示所有IP)
grant all privileges on *.* to '用户名'@'%' identified by '密码' with grant option;
flush privileges;
5. 更新用户信息
# 根据user和host条件 更新host为 %
update user set Host = '%' where Host = 'localhost' & user = 'xxxin_999';
flush privileges;
6. 删除用户
delete from user where user="xxxin_999" and Host="localhost";
flush privileges;