mysql 设置所有ip均可访问(windows版本设置)
1. 登录 mysql
# mysql -u root -p 密码
2. 使用 mysql 表
# use mysql;
3.查询user表中的user列和host列的数据
# select user,host from user;
4. 将user表中user=root,host=localhost改为user=root,host=%
# update user set host='%' where user='root';
或
# grant all privileges on \*.* to root@'%' identified by 'root';
其中 第一个表示数据库名;第二个表示该数据库的表名;如果像上面那样 *.*的话表示所有到数据库下到所有表都允许访问;
‘%’:表示允许访问到mysql的ip地址;当然你也可以配置为具体到ip名称;%表示所有ip均可以访问;
5. 重新进行查询
# select user,host from user;