栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

SQLyoq远程连接linux的MySQL

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

SQLyoq远程连接linux的MySQL

1.1打开telnet服务

1.2关闭防火墙



1.3关闭Linux虚拟机防火墙

在终端输入,查看防火墙状态

systemctl status firewalld

关闭防火墙

systemctl stop firewalld

关闭防火墙自启动

systemctl disable firewalld

再查看防火墙状态

systemctl status firewalld
1.4 开启mysql远程连接

进入opt文件夹

[root@liujiangtao01 ~]# cd /opt

进入MySQL

[root@liujiangtao01 opt]# mysql -uroot -p

进入库,再查看可连接用户

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select host,user from user;
+-----------+------------------+
| host      | user             |
+-----------+------------------+
| localhost | mysql.infoschema |
| localhost | mysql.session    |
| localhost | mysql.sys        |
| localhost | root             |
+-----------+------------------+
4 rows in set (0.00 sec)

改成可以远程连接的IP

mysql> update user set host = '192.168.118.%' where user = 'root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

查看是否成功

mysql> select host,user from user;
+---------------+------------------+
| host          | user             |
+---------------+------------------+
| 192.168.118.% | root             |
| localhost     | mysql.infoschema |
| localhost     | mysql.session    |
| localhost     | mysql.sys        |
+---------------+------------------+
4 rows in set (0.00 sec)

刷新

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

mysql> 

再更改密码

 ALTER USER 'root'@'192.168.118.%' IDENTIFIED WITH mysql_native_password BY '密码';

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/945813.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号