#登录mysql
mysql -uroot -p;
use mysql;
#所有ip能访问
GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘123‘ WITH GRANT OPTION;
#设置某个ip能访问
GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘192.168.1.3‘ IDENTIFIED BY ‘123‘ WITH GRANT OPTION;
#刷新权限
FLUSH PRIVILEGES;