This bash script will create a backup of all databases on the given mysql server with structure only (NO DATA). It will save that into a backup file, then restore to the same server dropping, then creating each databse from the backup schema. Effectivley this will remove all data from all databases on the mysql server while leaving all mysql system databases alone.
Replace the quoted values of the variables YOUR_HOST
, YOUR_USER
, and YOUR_PASS
with your connection
specific information. Then just run the script: bash remove-data.sh
Note you may need to make the script executable first via chmod +x remove-data.sh