How to backup database using mysqldump?

79 Views Asked by At

I'm trying to take a backup of a mysql database using the following code:

@echo off
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%b-%%a-%%c)
For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set mytime=%%a-%%b)
mysqldump -uroot -pas imed_dbsys > "D:\IMED CMS BACKUP\%mydate%_%mytime%.sql"

I want to name database backups using date and time.

My Expected Output:

2021-12-13_03-42 PM.sql

The output that shows in the folder (Date was not shown):

2021-12-_03-42 PM.sql

Can you help me to fix this problem? Thank you so much :D And I'm sorry to my English Grammar :)

0

There are 0 best solutions below