MENU

#Linux运维教程#centos7 按照mysql无法远程连接

December 22, 2018 • Linux阅读设置

遇到这种问题首先我们要确定是否开启所有ip可以连接。
选择mysql数据库

use mysql;
执行如下操作

GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION;
刷新一下

flush privileges;

ok,远程登录可以的,不信可以查看一下

select host,user from user;

如果还是不可以那么可能是防火墙的原因,这里我们先禁用其他文章讲如何加入端口到防火墙例外;
停止firewall
systemctl stop firewalld.service
禁止firewall开机启动
systemctl disable firewalld.service

Leave a Comment

2 Comments
  1. grant all privileges on *.* to 'root'@'%' identified by 'youpassword' with grant option;

  2. xixi xixi

    grant all privileges on *.* to 'root'@'%' identified by 'MbeS7wP3ss4!' with grant option;