0%

MySql_无法远程root登录

MySql_无法远程root登录:

  • 远程工具连接到数据库,需要开启root远程登陆

  • 1. 登录mysql
[root@htuidc ~]# mysql -u root -p
Enter password: # 输入密码

  • 2. 开启远程连接
[root@htuidc ~]# GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '' WITH GRANT OPTION;

## 将 替换成你自己的密码

## root为mysql用户,为用户密码

  • 3. 刷新权限
[root@htuidc ~]# FLUSH PRIVILEGES; 

  • 4. 安装iptables
[root@htuidc ~]# yum install -y iptables

  • 5. 编辑开放端口列表,增加3306端口,重启防火墙即可。
[root@htuidc ~]# firewall-cmd --permanent --zone=public --add-port=8080/tcp
[root@htuidc ~]# firewall-cmd --reload
## 开放3306到防火墙,并立即生效