【问题标题】:mysql not able to establish remote connectionmysql无法建立远程连接
【发布时间】:2020-05-10 12:59:52
【问题描述】:

无法使用 mysql 工作台或直接命令行连接到远程 mysql 服务器。 尝试时解析不同的主机名

直接通过命令行尝试时

mysql --host=10.37.1.92 --port=3306 --user=root --password=password
Warning: Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'myaapvm.local' (using password: YES)

试过了,有密码没密码,都不行。

我尝试连接到 10.37.1.92 服务器,但我的 mysql 客户端尝试连接到不同的服务器。我现在可以尝试的唯一方法是直接登录机器并在我的数据库中进行更改。我在我的 mysql 数据库中禁用了防火墙。有没有人遇到过这个问题,请帮忙。

此服务器运行 maria DB 安装。

【问题讨论】:

    标签: mysql mariadb mysql-workbench redhat


    【解决方案1】:

    默认情况下,不允许 root 使用远程连接访问数据库。我建议您创建一个用于远程连接的新用户。您可以使用以下 SQL 命令来执行此操作:

        CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypass';
        CREATE USER 'myuser'@'%' IDENTIFIED BY 'mypass';
    
        GRANT ALL ON *.* TO 'myuser'@'localhost';
        GRANT ALL ON *.* TO 'myuser'@'%';
        FLUSH PRIVILEGES;
    

    如果您还没有这样做,您还需要修改您的 my.cnf。

        #Replace xxx with your IP Address 
        bind-address        = xxx.xxx.xxx.xxx
    

    【讨论】:

      猜你喜欢
      • 2011-10-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-12
      • 2021-01-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多