Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL 5.6 - how to create a backup on Windows using mysqldump without a password prompt

I am a MySQL novice but need to schedule a task to automatically back up my databases.

I have managed to create a backup manually using the following command :-

mysqldump -u root -p --all-databases > "a:\mysql\all_databases.sql"

But I cannot work out how to run the command without having to manually enter my password. I have tried:--

mysqldump -u root -p'*my password*' --all-databases > "a:\mysql\all_databases.sql" 

Which appears to execute, but the resultant file is only 1kB in size. Whereas the first command generates a file that is 2661kB.

Can anyone help me?

like image 433
Highly Sceptical Avatar asked Feb 15 '23 01:02

Highly Sceptical


1 Answers

Try the following command, replace "your_password" with the root password:

mysqldump --user=root --password=your_password --all-databases >"a:\mysql\all_databases.sql"
like image 136
ethanh Avatar answered Feb 27 '23 10:02

ethanh