Skip to content

Instantly share code, notes, and snippets.

@xuhang57
Created July 29, 2019 14:56
Show Gist options
  • Save xuhang57/89edd0a3695931fc25a105db10cc6232 to your computer and use it in GitHub Desktop.
Save xuhang57/89edd0a3695931fc25a105db10cc6232 to your computer and use it in GitHub Desktop.
Mariadb drop database and free the disk space
#!/bin/sh
# mysqldump -u[root] -p[root_password] [database_name] > [dbdump].sql
mysqladmin -u[root] -p[root_password] drop [database_name]
sudo systemctl stop mariadb
sudo rm /var/lib/mysql/ibdata1
sudo rm /var/lib/mysql/ib_logfile*
sudo systemctl start mariadb
# mysqladmin -u[root] -p[root_password] create [database_name]
# mysqladmin -u[root] -p[root_password] [database_name] < [dbdump].sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment