在安装完mysql后为了安全我们要删除匿名账户,为了协同工作我们要开启远程登录,默认只能在本地登录
1、删除匿名账户
delete from mysql.user where user='';
2、修改root密码
update mysql.user set password=password('yourpassword') where user='root';
3、开启远程登录
grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
flush privileges;
4、新建用户
grant all privileges on *.* to 'newuser'@'%' identified by 'password' with grant option;
flush privileges;
说明:
grant option_1, option_2, option_3.... on dbname.tablename to username @ domain indetified by passwd with grant option;