标签:
CODE:mysql -u root -p123
mysql>use mysql;
mysql>update user set host = ‘%‘ where user = ‘root‘;
mysql>select host, user from user;
注:其实我们可以新增一个用户,把必要的权限授予于这个用户,且将这个用户的host设为%
GRANT ALL PRIVILEGES ON *.* TO ‘myuser‘@‘%‘ IDENTIFIED BY ‘mypassword‘ WITH GRANT OPTION;
FLUSH PRIVILEGES;
GRANT ALL PRIVILEGES ON *.* TO ‘myuser‘@‘192.168.1.3‘ IDENTIFIED BY ‘mypassword‘ WITH GRANT OPTION;
FLUSH PRIVILEGES;
注:不同系统的主机会产生不同的结果,1:windows下一般按照上面的其中一种操作就可以了;2、对于linux环境,仅仅按上面步骤操作还不够,具体步骤如下:
找到自己mysql安装目录下的相应配置文件/etc/mysql/my.cnf
注释掉 “bind-address = 127.0.0.1” 即可
标签:
原文地址:http://www.cnblogs.com/hf8051/p/5122264.html