How can I empty the contents of all tables in my database in phpMyAdmin without dropping any of the tables in the database?
Since I do this several times an hour while i
The TRUNCATE TABLE
statement will empty a table completely (MySql 3.23 and above).
You can create a script that you can reuse for a particular database. It's not generic but saves you from creating a new database + login each time you want to start with a fresh db.
Here's how to create a script yourself:
In your webbrowser go to phpMyAdmin and select the database. Click the SQL tab and execute 'SHOW TABLES'
.
Choose the printerfriendly format and copy the contents to a text editor.
Now for each table name you re-write it in the format:
TRUNCATE TABLE ;
note: You can use a regular expression if you have many tables