无法使用 MySQL Workbench 访问 Mariadb (Centos 7)

ALM*_*ALM 5 mysql mysql-workbench mariadb centos7

我已经安装MariadbCentos 7,我试图与访问它MYSQL Workbench

我做了以下工作:

启动 MariaDB 执行以下命令:

 systemctl start mariadb.service
Run Code Online (Sandbox Code Playgroud)

自动启动 MariaDB 执行以下命令:

 systemctl enable mariadb.service
Run Code Online (Sandbox Code Playgroud)

启动 MariaDB 后(只执行一次),执行以下命令:

  /usr/bin/mysql_secure_installation
Run Code Online (Sandbox Code Playgroud)

运行时我删除了匿名用户登录

我们还需要更改端口: /etc/my.cnf.d/server.cnf # Mariadb 网络设置

[mysqld]
# comment out the bind address
#bind_address=127.0.0.1 
Run Code Online (Sandbox Code Playgroud)

现在我会得到一个错误

[root@localhost ~]# mysql -u root -p mcellblock -h 192.168.159.163 -P 3306
Enter password:
ERROR 1130 (HY000): Host '192.168.159.163' is not allowed to connect to this MariaDB server
Run Code Online (Sandbox Code Playgroud)

然后我启用了连接权限:

  GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
  GRANT ALL PRIVILEGES ON *.* TO 'mcb'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
  FLUSH PRIVILEGES;

  MariaDB [mcellblock]> select User, Host, password from mysql.user where Host <> 'localhost';
  +------+-----------------------+-------------------------------------------+
  | User | Host                  | password                                  |
  +------+-----------------------+-------------------------------------------+
  | root | localhost.localdomain | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
  | root | 127.0.0.1             | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
  | root | ::1                   | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
  | root | %                     | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
  | mcb  | %                     | *A071D903A1ABA9752B05C16C573A095C80A7AFAD |
  +------+-----------------------+-------------------------------------------+
  5 rows in set (0.00 sec)
Run Code Online (Sandbox Code Playgroud)

现在,当我尝试通过终端访问时,它可以工作:

  $ mysql -u mcb -p mcellblock -h 192.168.159.163 -P 3306
  Enter password:
  Welcome to the MariaDB monitor.  Commands end with ; or \g.
  Your MariaDB connection id is 28
  Server version: 5.5.47-MariaDB MariaDB Server
Run Code Online (Sandbox Code Playgroud)

但是当我尝试通过 MySQL Workbench 访问时,出现错误:

 Please check
  1) Check that mysql is running on server 192.168.159.163  ** IT IS
  2) Check that mysql is running on port 3306 ** I can connect to it via the terminal so I assume it is
  3) Check mcb has the rights to connect to 192.168.159.163 from your address ** It should as its setup for %
  4) Make sure you are both providing a password if needed and using the correct password for 192.168.159.163 ** the passwords are the same
Run Code Online (Sandbox Code Playgroud)

当我在本地安装 MySQL Workbench 时,它可以运行,但不能远程运行。

有谁知道我缺少什么或如何解决这个问题?

ALM*_*ALM 2

事实证明这是centos机器上的防火墙问题。检查 telnet IP_ADDRESS 3306 后。我无法通过其他虚拟机或 Windows 进行访问。禁用防火墙后,它起作用了。

@Alex 我之前也检查过端口,它正在正确监听。谢谢您的意见。