[root@6721 mysql5.7]#mysql -uroot -p
Enter password:
mysql: [Warning] Using a password on the command line interface can be insecure.
......
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> set password=password("root");
mysql> grant all privileges on *.* to root@'%' identified by 'root' with grant option;
mysql> flush privileges;
mysql> exit;