我正在运行Debian 8.2,安装非常新鲜。 我尝试使用Sequel Pro通过SSH连接到我的MySQL服务器。 我总是得到这个错误:
Lost connection to MySQL server at 'reading initial communication packet', system error: 0
当我跑步
mysql -u root -p
在服务器上,一切正常。 但不是来自遥远的。
起初我以为它可能是iptables,所以我(暂时)禁用所有的规则。 iptables -L现在返回:
Chain INPUT (policy ACCEPT) target prot opt source destination Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination
然后我检查my.cnf,但是我能想到的所有参数看起来都是正确的:
[client] port = 3306 socket = /var/run/mysqld/mysqld.sock [mysqld_safe] socket = /var/run/mysqld/mysqld.sock nice = 0 [mysqld] user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock port = 3306 basedir = /usr datadir = /var/lib/mysql tmpdir = /tmp lc-messages-dir = /usr/share/mysql skip-external-locking bind-address = 127.0.0.1
我的mysql日志文件的输出也看起来不错
150609 17:15:07 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 150609 17:15:07 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead. 150609 17:15:07 [Note] /usr/sbin/mysqld (mysqld 5.5.43-0+deb8u1) starting as process 18347 ... 150609 17:15:07 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead. 150609 17:15:07 [Note] Plugin 'FEDERATED' is disabled. 150609 17:15:07 InnoDB: The InnoDB memory heap is disabled 150609 17:15:07 InnoDB: Mutexes and rw_locks use GCC atomic builtins 150609 17:15:07 InnoDB: Compressed tables use zlib 1.2.8 150609 17:15:07 InnoDB: Using Linux native AIO 150609 17:15:07 InnoDB: Initializing buffer pool, size = 128.0M 150609 17:15:07 InnoDB: Completed initialization of buffer pool 150609 17:15:07 InnoDB: highest supported file format is Barracuda. 150609 17:15:07 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended 150609 17:15:08 InnoDB: Waiting for the background threads to start 150609 17:15:09 InnoDB: 5.5.43 started; log sequence number 1654586 150609 17:15:09 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306 150609 17:15:09 [Note] - '127.0.0.1' resolves to '127.0.0.1'; 150609 17:15:09 [Note] Server socket created on IP: '127.0.0.1'. 150609 17:15:09 [Note] Event Scheduler: Loaded 0 events 150609 17:15:09 [Note] /usr/sbin/mysqld: ready for connections.
而且我无法find任何与我的客户端configuration有关的问题:
MySQL Host: 127.0.0.1 User: root Password: *** Port: 3306 SSH Host: mydomain.com SSH User: sshuser SSH Key: sshkey
我也没有任何东西在/etc/hosts.allow和/etc/hosts.deny
请注意,SSH连接成功,但MySQL失败。
我搞不清楚了。 任何人都可以帮忙吗?
那么,如果有人应该遇到同样的问题:
自我注意:设置SSH时,必须在/ etc / ssh / sshd_config中设置以下选项:
AllowTcpForwarding是的
如果你不这样做,那么你的数据包将被悄悄地丢弃在服务器上。 这导致上面的错误消息。
信贷去了