mysql - git没有密码无法访问mysql数据库

标签 mysql shell

我正在尝试从终端访问 github 数据库,但收到此错误。有什么建议么?以下是访问数据库的链接。

http://ghtorrent.org/mysql.html

  ssh -L 3306:web.ghtorrent.org:3306 ghtorrent@web.ghtorrent.org
  Enter passphrase for key '/Users/abc/.ssh/id_rsa': 
  bind: Address already in use
  channel_setup_fwd_listener_tcpip: cannot listen to port: 3306
  Could not request local forwarding.
  PTY allocation request failed on channel 0

  on the other terminal 2
  mysql -u ght -h 127.0.0.1 ghtorrent
  ERROR 1045 (28000): Access denied for user 'ght'@'localhost' (using password: NO)

最佳答案

本地系统上的某些东西(可能是本地 mysqld)已经在监听端口 3306,因此您的端口转发不起作用,正如 ssh 试图在这一系列错误消息中解释的那样:

bind: Address already in use
channel_setup_fwd_listener_tcpip: cannot listen to port: 3306

使用不同的本地端口,并在 mysql 客户端调用中指定该端口。例如,要使用端口 33306:

ssh -L 33306:web.ghtorrent.org:3306 ghtorrent@web.ghtorrent.org

mysql -u ght -h 127.0.0.1 -P 33306 ghtorrent

关于mysql - git没有密码无法访问mysql数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48321082/

相关文章:

MySQL - 不同结果显示每组最新记录

bash - 如果匹配,则打印 awk 中的列,如果不匹配,则仍然打印该行(没有该列)

linux - 执行一系列历史命令

shell - Docker exec 需要最少 2 个参数

linux - 从文本文件 shell 脚本中删除 "empty"行

mysql - 使用单个查询更新 SQL

mysql 按序列化数据排序?

java - 是否可以将 MySQL 数据库服务器嵌入到 Java servlet 中?

php - Laravel - 如何查找外键值

bash - 我该如何改进这个脚本?