服务器mysql已经启动端口也已经开放
$ telnet 10.10.1.102 3306
Trying 10.10.1.102...
Connected to 10.10.1.102.
Escape character is '^]'.
4
5.0.22 ke9.v,t' , a4|9D*E]&@QV Connection closed by foreign h
st.user表权限如下
mysql> select host,user from mysql.user;
+-----------------------+-------+
| host | user |
+-----------------------+-------+
| % | model |
| localhost | root |
| localhost.localdomain | root |
+-----------------------+-------+
3 rows in set (0.00 sec)Db表
mysql> select host,user from mysql.db;
+------+-------+
| host | user |
+------+-------+
| % | model |
+------+-------+
1 row in set (0.00 sec)当在windows机器链接远程服务的时候
$ mysql -u model -p -h 10.10.1.102
Enter password: *****
ERROR 2003 (HY000): Can't connect to MySQL server on '10.10.1.102' (10061)
加个参数
$ mysql -u model -p -h 10.10.1.102 --protocol=TCP --port=3306
Enter password: *****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 32
Server version: 5.0.22Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.就能链接上了原因在于我的客户端端口是3307 服务端是3306.
问题解决了。
$ telnet 10.10.1.102 3306
Trying 10.10.1.102...
Connected to 10.10.1.102.
Escape character is '^]'.
4
5.0.22 ke9.v,t' , a4|9D*E]&@QV Connection closed by foreign h
st.user表权限如下
mysql> select host,user from mysql.user;
+-----------------------+-------+
| host | user |
+-----------------------+-------+
| % | model |
| localhost | root |
| localhost.localdomain | root |
+-----------------------+-------+
3 rows in set (0.00 sec)Db表
mysql> select host,user from mysql.db;
+------+-------+
| host | user |
+------+-------+
| % | model |
+------+-------+
1 row in set (0.00 sec)当在windows机器链接远程服务的时候
$ mysql -u model -p -h 10.10.1.102
Enter password: *****
ERROR 2003 (HY000): Can't connect to MySQL server on '10.10.1.102' (10061)
加个参数
$ mysql -u model -p -h 10.10.1.102 --protocol=TCP --port=3306
Enter password: *****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 32
Server version: 5.0.22Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.就能链接上了原因在于我的客户端端口是3307 服务端是3306.
问题解决了。
解决方案 »
- MySQL connector .net 6.3.6 不能顯示在c#
- mysql 存储过程可以有几个参数?
- 如何将my sql文件转换成ms sql文件
- 【c语言】明明执行了mysql_close,可为什么还是存在大量的ESTABLISHED链接?
- 请教存储过程不能多条insert的问题.
- 求救贴 !!!!!!!
- 安装出错(start service)不能启动
- 烦,烦,烦,我的数据库默认的字符集为GBK,字段也是字符集为GBK,为什么会报字符集不正确呢
- mysql 在pb中使用insert,添加中文出现问题,如何解决?
- 相同的字段如何自增值
- 请教一个数据库查询问题
- postgresql 磁盘备份
原因在这
你在本地用cmd命令通过mysql去连,则默认用本地环境变量中的mysql客户端的端口去连,而你的服务端的端口不是3307,所以,才报那个socket的10061的错误,你只要加参数-P指定端口就可以解决了。
其实这个错误已经很明显了,10061,典型的socket错误