今天在用ip地址连接mysql的时候,发现有问题,用localhost或127.0.0.1的时候可以正常连接:
为了防止以后遇到类似问题,特此记录下来:
mysql -u root -p
use mysql;
grant all privileges on *.* to root@"%" identified by 'abc' with grant option;
flush privileges;
之后再重启mysql服务即可
今天在用ip地址连接mysql的时候,发现有问题,用localhost或127.0.0.1的时候可以正常连接:
为了防止以后遇到类似问题,特此记录下来:
mysql -u root -p
use mysql;
grant all privileges on *.* to root@"%" identified by 'abc' with grant option;
flush privileges;
之后再重启mysql服务即可