Mysql – Less than operator not working on where clause in thesqldump

mariadbMySQL

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.

Best Answer

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.