1、 set password for root@localhost = password('newpassword');
2、修改/etc/mysql/my.cnf文件内,注释bind-address = 127.0.0.1
3、然后在mysql>这里输入:grant all on *.* to username@'%' identified by 'password;
注意:username是用户名,password是要自己填写的一个名字,例如:
grant all on *.* to zl@'%' identified by '123456';
4、执行:flush privileges;
5、/etc/init.d/mysql restart