修改可连接mysql的IP

时间:2025-03-30 14:21:47

在mysql主机上操作:

mysql -u root -p

use mysql;

select host,user,password from user;

+---------------------+------+--------------------+
| host                    | user | password        |
+---------------------+------+--------------------+
| localhost            | root |                           |
| 127.0.0.1           | root | ***************** |
| localhost            |         |                           |
| 192.168.1.2      | root | ***************** |
| 192.168.1.10    | root | ***************** |

把需要修改的IP改成当前电脑的IP就可以了

update user set host='192.168.1.10' where host='192.168.1.188';

别忘记运行下面一句。

flush privileges;