Centos8+MariaDB+Workbench远程连接出现Lost connection to MySQL......(跳坑加已解决)

小编想连接远程的mariaDB数据库弹出框出现了

Lost connection to MySQL server at ‘reading initial communication packet’, 的错

解决方法

  • 1 开启端口3306
    firewall-cmd --add-port=3306/tcp --premanent # 其中–premanent代表永久开启,重启机器不在关闭
  • 2 数据库授权远程
    MariaDB [(none)]> grant all on . to [email protected]’%’ identified by ‘root’;
    如果提示没有选数据库,可以选 use mysql再执行即可。
    Centos8+MariaDB+Workbench远程连接出现Lost connection to MySQL......(跳坑加已解决)
    连接即可。