Difference between revisions of "Mysql delete data via cli"

From thelinuxwiki
Jump to: navigation, search
(Pushed from Themanclub.)
 
 
(One intermediate revision by one user not shown)
Line 2: Line 2:
 
== deleting range from shell ==
 
== deleting range from shell ==
 
delete user_id if greater than 2
 
delete user_id if greater than 2
  mysql -h localhost -u root mediawiki -e "DELETE FROM thelinuxwiki_user WHERE user_id > '2'" --password=password
+
  mysql -h localhost -u root mediawikidb -e "DELETE FROM thelinuxwiki_user WHERE user_id > '2'" --password=password
 +
 
 +
the above command was used to delete everything but the admin user. 
 +
 
 +
delete all transactions in gnucash
 +
 
 +
> DELETE FROM transactions WHERE guid IS NOT NULL;
  
 
[[category:mysql]]
 
[[category:mysql]]

Latest revision as of 22:10, 8 February 2015

deleting range from shell

delete user_id if greater than 2

mysql -h localhost -u root mediawikidb -e "DELETE FROM thelinuxwiki_user WHERE user_id > '2'" --password=password

the above command was used to delete everything but the admin user.

delete all transactions in gnucash

> DELETE FROM transactions WHERE guid IS NOT NULL;