Windows 下mysqldump备份1045错误解决办法
一、我写的备份脚本如下
set d=%date:~0,4%%date:~5,2%%date:~8,2% C:\mysqldump -uroot -ptest@2018 --all-databases > D:\backup\db_test\db_test_%d%.sql
二、报错如下
mysqldump: Got error: 1045: Access denied for user 'root'@'localhost' (using password: YES) when trying to connect
三、解决办法如下
后来终于咨询到,密码上添加双引号即可!!! set d=%date:~0,4%%date:~5,2%%date:~8,2% C:\mysqldump -uroot -p"test@2018" --all-databases > D:\backup\db_test\db_test_%d%.sql
感谢论坛朋友们的解答!
方法总比问题多