mysql 端口转发_mysql端口转发的奇怪行为

我在我的机器上设置了MySQL端口转发:

I have set up MySQL port forwarding in my machine as:

ssh -f -N -L :9906:localhost:3306 《ssh login》

现在,如果我尝试从我的localhost连接到MySQL:

Now, if I try to connect to MySQL from my localhost as:

mysql -u《user》 -p《password》 -P9906 -h127.0.0.1 《schema》

工作正常。 但是,如果我在本地取出 `-` h参数,即,如果我从localhost连接到MySQL,如下所示:

It works fine. But, if I take out the `-`h parameter in my local, i.e, if I connect to MySQL as below from localhost:

mysql -u《user》 -p《password》 -P9906 《schema》

我收到以下错误:

I get the following error:

>

>

> 错误1045(28000):对用户'''localhost'的访问被拒绝。 (使用密码:是)

》 ERROR 1045 (28000): Access denied for user ''@'localhost' (using password: YES)

为什么会出现这种情况?

Why this behaviour?

我曾尝试为localhost和127.0.0.1设置端口转发,但错误仍然存在。

I have tried to set the port forwarding for both localhost as well as 127.0.0.1, but the error still remains.

此外,在服务器上,已为localhost和127.0.0.1提供了用户权限。

Also, on the server, have given privilege to the user for both localhost as well as 127.0.0.1.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值