1. 登录 mysql

mysql -u root -p

2. 切换到 mysql 数据库

USE mysql;
SELECT user,host FROM user;

3. 授权

GRANT ALL PRIVILEGES ON *.* TO root@my_ip IDENTIFIED BY ‘root_password‘ WITH GRANT OPTION;