8.0之前
GRANT ALL PRIVILEGES ON *.* TO root @'localhost' IDENTIFIED BY 'YourPassword';
GRANT ALL PRIVILEGES ON *.* TO root @'127.0.0.1' IDENTIFIED BY 'YourPassword';
8.0之后
create user root@'%' identified by 'YourPassword';
grant all privileges on *.* to root@'localhost' with grant option;