Clean database ubuntu/RHEL/SUSE use uninstall_package and clean /var/lib/mysql

Change-Id: I72c9df06903e536320a807fae8b817379e448444
Related-Bug: #1395776
This commit is contained in:
Sean Dague 2014-12-15 14:57:15 -05:00 committed by Zhang Jinnan
parent affcf87181
commit 1cbb5d3f0c

View File

@ -23,22 +23,27 @@ function cleanup_database_mysql {
if is_ubuntu; then if is_ubuntu; then
# Get ruthless with mysql # Get ruthless with mysql
stop_service $MYSQL stop_service $MYSQL
apt_get purge -y mysql* uninstall_package mysql-server mariadb-server
sudo rm -rf /var/lib/mysql sudo rm -rf /var/lib/mysql
sudo rm -rf /etc/mysql sudo rm -rf /etc/mysql
return return
elif is_fedora; then elif is_fedora; then
if [[ $DISTRO =~ (rhel6) ]]; then if [[ $DISTRO =~ (rhel6) ]]; then
MYSQL=mysqld stop_service mysqld
uninstall_package mysql-server
sudo rm -rf /var/lib/mysql
else else
MYSQL=mariadb stop_service mariadb
uninstall_package mariadb-server
sudo rm -rf /var/lib/mysql
fi fi
elif is_suse; then elif is_suse; then
MYSQL=mysql stop_service mysql
uninstall_package mysql-community-server
sudo rm -rf /var/lib/mysql
else else
return return
fi fi
stop_service $MYSQL
} }
function recreate_database_mysql { function recreate_database_mysql {