假设 192.168.1.1 是 MySQL 数据库所在的服务器,192.168.1.2 是客户端,如何在 192.168.1.2 上远程登录到 192.168.1.1 数据库上
[[email protected] ~]# mysql -uroot -proot # 先授权哪些主机可以远程登录到数据库 mysql> grant all on *.* to ‘root‘@‘192.168.1.2‘ identified by ‘root‘;
[r[email protected] ~]# mysql -uroot -h192.168.1.1 -P3306 -proot # 远程登录数据库,-h 指定远程数据库地址,-P 指定远程数据库监听端口
时间: 2024-08-05 02:54:02