mysqldump: Got error: 1045: Access denied for user 'root'@'localhost' (using password: YES) when try

时间:2021-12-03 19:19:24

mysqldump: Got error: 1045: Access denied for user ‘root’@’localhost’ (using password: YES) when trying to connect


解决办法:

登录mysql客户端
mysql -hserverip -uroot -p  或者 mysql -u root
mysql> use mysql;
set password for 'root'@'localhost' =password(''); 
flush privileges;
显示当前的user:
mysql> SELECT USER();