0

I am trying to backup some tables with the built in mysqldump function from MariaDb version 10.4. My tables all have a column called insertDateTime with a timestamp in the form of 2019-09-11 12:00:00

Querying one of my tables with the simple statement:

select * from account where insertDateTime < '2019-08-13 18:00:00'

will return a set of rows where that condition matches. However when I run the following code in command prompt no rows are returned in my dumped sql file.

C:
cd c:\Backup_Location

"C:\Program Files\MariaDB 10.4\bin\mysqldump.exe" -u root -p password database account > account.sql --where="insertDateTime < '2019-08-13 18:00:00'"

I have been wracking my brain on why these two statements should return different amounts of rows but am unable to figure out why. Does anyone know why this would be.

New contributor
Matthew Singer is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • yup it was due to time zones. I did not know that they adjusted all timestamps to greenwich mean time – Matthew Singer Sep 11 at 18:31
  • 1
    You could write that up as an answer - may help future posters? No points for answering your own question though! :-( - p.s. welcome to the forum! :-) – Vérace Sep 11 at 18:45
0

Put the options first. That is, all parameters that start with - or -- before the non-option parameters (database account) and redirection (> ... or < ...)

If that does not suffice, then remember that the command line processor is handling the first level of quotes, so change to

"--where=insertDateTime < '2019-08-13 18:00:00'"

(but I am not confident that this will help)

The quotes are to deal with spaces that are not separators -- as in the middle of the path or the 'where' expression.

Your Answer

Matthew Singer is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.