Generally if you like to truncate or empty all the records in a database containing more no. of tables, use the below command to do it. It really helps to remove all the records completely only having the structure of the tables left in a database.
mysql -u {user-name} -p {database-name} -BNe "show tables" | awk '{print "TRUNCATE TABLE " $1 ";"}' | mysql -u {user-name} -p {database-name}
Let me know if it doesn't works you out.
No comments:
Post a Comment