设置MySql允许外部连接的方法

在linux上或window下cmd命令行下用root登陆,设置权限,grant 权限名(sqlserver和mysql不一样的,可以看手册知道,分所有的权限用all) on    库名(*表全部).表名 to  要授权的用户名@"%"(%表示所有的IP,可以只些一个IP) identified by "密码"; 
通常我都是写grant all on *.* to root@"%" identified by "密码"; 

 


远程连接问题,可以参考:


1、MYSQL服务器上:
比如:
C:\>mysql -uroot -p
Enter password: ******
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.22-rc-community-log MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> grant all privileges on *.* to 'yourname'@'%' identified by 'youpasswd';
Query OK, 0 rows affected (0.05 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.06 sec)

mysql> exit
Bye
开启3306的方法:
http://www.google.cn/search?hl=zh-CN&q=%E5%BC%80%E5%90%AF3306&meta=
2、这里假设用SQLYog连接MYSQL服务器。
客户端机器上:
HOST ADDRESS:服务端IP地址
USER NAME:yourname
PASSWORD:yourpasswd
PORTS:3306
DATABASES:可以留空。
 
 
posted @ 2012-05-03 09:33  sjhnanwang  阅读(436)  评论(0编辑  收藏  举报