mysqldump with --where clause is not working

前端 未结 2 1570
旧巷少年郎
旧巷少年郎 2020-12-29 04:22
 mysqldump -t -u root -p  mytestdb mytable --where=datetime LIKE \'2014-09%\'

This is what I am doing and it returns:

mysqldump: C         


        
相关标签:
2条回答
  • 2020-12-29 05:04

    Selecting dates using LIKE is not a good idea. I saw this method in one project. This causes huge DBMS load and slow system operation as no index by this table column used.

    If you need to select date range use between:

    where datetime between '2014-09-01' and '2014-09-30 23:59:59'
    
    0 讨论(0)
  • 2020-12-29 05:06

    You may need to use quotes:

    mysqldump -t -u root -p  mytestdb mytable --where="datetime LIKE '2014-09%'"
    
    0 讨论(0)
提交回复
热议问题