I am trying to empty the database of any data, while keeping the relationships and tables as they are
I have no idea if my thinking is right or wrong
I am trying to empty the database of any data, while keeping the relationships and tables as they are
I have no idea if my thinking is right or wrong
Yes, you just run mysqldump with --no-data
mysqldump --no-data -u someuser -p mydatabase
You can save it to a .sql file and then drop your database Then you restore it from the dump
truncate table_name;
table_name is the table you want to delete all data in it. truncate only works on tables, so you need to execute truncate table one by one.
Use truncate to all table :
mysqldump -d -uuser -ppass --add-drop-table databasename > databasename.sql
mysql -uuser -ppass databasename < databasename.sql
or you can read this, similar problem.