无法使用ssh-tunnel连接到mySQL,但本地连接工作正常

fcipmucu  于 2024-01-05  发布在  Mysql
关注(0)|答案(1)|浏览(182)

我尝试使用ssh-tunnel连接到mySQL,但得到“Access denied for user 'bitrix 0'@'::1'(using password:YES)”I“,使用DBeaver。
但本地连接工作正常

  1. [root@bitrixc2 ~]# mysql -u bitrix0 -p
  2. Enter password:
  3. Welcome to the MySQL monitor. Commands end with ; or \g.
  4. Your MySQL connection id is 23597
  5. Server version: 5.7.39-42 Percona Server (GPL), Release 42, Revision b0a7dc2da2e
  6. Copyright (c) 2009-2022 Percona LLC and/or its affiliates
  7. Copyright (c) 2000, 2022, Oracle and/or its affiliates.
  8. Oracle is a registered trademark of Oracle Corporation and/or its
  9. affiliates. Other names may be trademarks of their respective
  10. owners.
  11. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  12. mysql>

字符串
用户列表:

  1. mysql> SELECT user, host FROM mysql.user WHERE user LIKE 'user' OR host LIKE 'localhost';
  2. +--------------------+-----------+
  3. | user | host |
  4. +--------------------+-----------+
  5. | SQLAdmin | localhost |
  6. | bitrix0 | localhost |
  7. | mysql.session | localhost |
  8. | mysql.sys | localhost |
  9. | root | localhost |
  10. +--------------------+-----------+
  11. 6 rows in set (0.00 sec)
  12. mysql>


我如何连接ssh-tunnel?或者可能是DBeaver有特殊的连接选项?我尝试用putty和DBeaver创建ssh-tunnel。两个变体都得到了相同的错误。

xmjla07d

xmjla07d1#

问题解决了。我用127.0.0.1主机创建了mysql用户

  1. #user_name and password was changed in this example
  2. CREATE USER 'user_user'@'127.0.0.1' IDENTIFIED BY 'secret_password';
  3. GRANT ALL PRIVILEGES ON * . * TO 'user_user'@'127.0.0.1';

字符串

相关问题