Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysqldump with --where clause is not working

 mysqldump -t -u root -p  mytestdb mytable --where=datetime LIKE '2014-09%' 

This is what I am doing and it returns:

mysqldump: Couldn't find table: "LIKE" 

I am trying to return all the rows where the column datetime is like 2014-09 meaning "all September rows".

like image 832
nodejsj Avatar asked Oct 08 '14 16:10

nodejsj


People also ask

Why Mysqldump is not working?

If mysqldump is not identified by the cmd prompt that means it cannot recognize where the mysqldump.exe is located. You need to add path of the directory where the exe is located in the PATH variable under environment variables. After doing that your command will start working in the cmd prompt.

What is path to Mysqldump?

The mysqldump tool is located in the root/bin directory of the MySQL installation directory.

Does Mysqldump lock table?

By default, mysqldump locks all the tables it's about to dump. This ensure the data is in a consistent state during the dump.

What privileges are needed for Mysqldump?

mysqldump requires at least the SELECT privilege for dumped tables, SHOW VIEW for dumped views, TRIGGER for dumped triggers, LOCK TABLES if the --single-transaction option is not used, and (as of MySQL 8.0.21) PROCESS if the --no-tablespaces option is not used.


1 Answers

You may need to use quotes:

mysqldump -t -u root -p  mytestdb mytable --where="datetime LIKE '2014-09%'" 
like image 187
Leonardo Herrera Avatar answered Sep 21 '22 08:09

Leonardo Herrera