What I'm trying to do is find the command to export a table excluding specific entries. Here are the various options I tried but without achieving the desired result.
The approach works only for export of a table but excluding one record:
mysqldump --user=... --password=... --host=... DB_NAME usertable --where username!='root'
If I try to use other operator for exclude more data, as below, the export failed:
mysqldump --user=... --password=... --host=... DB_NAME usertable --where username!='root' and username!='root2'
mysqldump --user=... --password=... --host=... DB_NAME usertable --where "username not in('root','root2')"
What is a functional approach?
CodePudding user response:
your syntax for the where is wrong as mysql needs a string for that
mysqldump --user=... --password=... --host=... DB_NAME usertable --where="username!='root' and username!='root2'"
mysqldump --user=... --password=... --host=... DB_NAME usertable --where="username not in('root','root2')"
please read more in the manual
