mysql> use mysql;
Query OK, 0 rows affected (0.01 sec)
mysql> update user set authentication_string=PASSWORD("123456") where user='root';
Query OK, 0 rows affected (0.01 sec)
mysql> update user set plugin="mysql_native_password";
Query OK, 0 rows affected (0.01 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)
service mysql restart
/etc/init.d/mysql restart