Hi when I run this command from ssh via root it doesn’t work. How do I get it to work without using the password? On my other servers it’s possible to run this command and it just works.
[root@- www]# mysqldump db > file.sql
mysqldump: Got error: 1045: Access denied for user ‘root’@‘localhost’ (using password: NO) when trying to connect
BTW, i’m running centos 6.2 64bit in root via command prompt ssh in latest vmin/wmin
ok, but on other servers no password is required since I’m already logged in as root it trumps all passwords normally. This is for an sh script so how would I get it so no password is prompted and it just dumps it without interuption.
MySQL would always require you to enter a password, if there is one set for the user you’re accessing.
The root user would indeed not require you to enter a password when accessing other user accounts on the server, but that’s different from accessing MySQL-based accounts.
Regarding the “>” in your command – that redirects the output of the mysqldump command into a file, rather than having it all display on the screen.
i have this problem too!
in my old server (with cPanel/WHM) i use a shell backup script that execute this command: mysqldump -u root DB_NAME > BACKUP_PATH.sql
in my new server (that use virtualmin), the command accrues an error: mysqldump: Got error: 1045: Access denied for user ‘root’@‘localhost’ (using password: NO) when trying to connect
it not seems safe to put root password (or password of any user that have full access to database) in simple backup.sh file! isn’t it?!
(i also use the mfleeson note but the problem not solved.)