mysqldump执行时Got error: 1045: Access denied for user 'root'@'localhost' (using password: YES) when trying to connect

解决办法

登录mysql客户端

mysql -hserverip -uroot -p

mysql> update user set password=password('new password') where user='root';
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4  Changed: 4  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> quit