1、[tiger@localhost ~]$ mysql -u root -p
Enter password: //这样应该可以进入MySQL服务器
2、mysql>GRANT ALL PRIVILEGES ON dbName.* TO test@'%' IDENTIFIED BY 'test' WITH GRANT OPTION;
--mysql>GRANT ALL PRIVILEGES ON dbName.* TO test@'%' IDENTIFIED BY 'test' ;
//赋予任何主机通过test 用户访问数据库dbName的权限
3、mysql>FLUSH PRIVILEGES
//修改生效
4、mysql>EXIT
//退出MySQL服务器
以上的这样就可以在其它任何的主机上以test身份登录啦!
客户端(windows)
c:\program files\mysql\mysql server 5.1\bin>mysql -h 192.168.48.130 -u test -p
enter password:
远程报错:
ERROR 2003(HY000):Can't connect to MySQL server on '192.168.48.130' (10065)
到linux 服务器中把防火墙添加端口tcp: 3306后就OK了。
1) 重启后生效
开启: chkconfig iptables on
关闭: chkconfig iptables off 网管联盟www.bitsCN.com
2) 即时生效,重启后失效
开启: service iptables start
关闭: service iptables stop 中国网管论坛bbs.bitsCN.com
需要说明的是对于Linux下的其它服务都可以用以上命令执行开启和关闭操作。 网管网bitsCN_com
在开启了防火墙时,做如下设置,开启相关端口,修改/etc/sysconfig/iptables 文件,添加以下内容:
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
C:\>mysql -h 192.168.48.130 -u test -p
Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.4.3-beta-community MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>