时间:2021-07-01 10:21:17 帮助过:2人阅读
mysql> USE mysql; -- 切换到 mysql DB Database changed mysql> SELECT User, Password, Host FROM user; -- 查看现有用户,密码及允许连接的主机 +------+----------+-----------+ | User | Password | Host | +------+----------+-----------+ | root | | localhost | +------+----------+-----------+ 1 row in set (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘192.168.1.100‘ IDENTIFIED BY ‘123456‘ WITH GRANT OPTION;(@后面填IP地址,TO后面为用户名,IDENTIFIED BY后面为用户密码)
mysql> flush privileges;
这样就允许远程访问,但是楼主在测试的过程中发现仍然不能远程访问,后来查找发现,原来是楼主的防火墙开启了,所以大家在测试的时候记得关掉自己的防火墙。
MySql远程连接
标签: