1.创建一个用户
CREATE USER username@localhost IDENTIFIED BY '123456';
( username 表示用户名,localhost为是来源的主机,%表示所有主机都可以访问)
2.赋予权限
grant all privileges on dbname.* to username@'%'
(dbname.* 赋予dbname 这个这个数据库所有的表权限给username )
3.修改用户权限,让远程主机登录mysql
use mysql;
update user set host = '%' where user ='root';
4.以上最后都要 让其生效
flush privileges;
附:http://blog.csdn.net/wengyupeng/article/details/3290415
http://blog.chinaunix.net/uid-9554532-id-2000700.html
http://my.oschina.net/leejun2005/blog/678202
http://my.oschina.net/u/573270/blog/423238
5.update mysql.user set authentication_string=password('xiaojiashi@XJS12076') where user='hteacher';