【散分】远程链接mysql
服务器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.22
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
就能链接上了
原因在于我的客户端端口是3307 服务端是3306.
问题解决了。