1. 授權用戶root使用密碼maozhuxi123從任意主機連接到mysql服務器
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'maozhuxi123' WITH GRANT OPTION;
flush privileges;
2.授權用戶root使用密碼maozhuxi123從指定ip為218.12.50.60的主機連接到mysql服務器
GRANT ALL PRIVILEGES ON *.* TO 'root'@'218.12.50.60' IDENTIFIED BY 'maozhuxi123' WITH GRANT OPTION;
flush privileges;