How to remove MySQL completely with config and library files?
So far I've tried the following commands:
sudo apt-get remove mysql-server mysql-client mysql-common
sudo apt-get purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
But whenever I try to locate MySQL using the following command, I get a list of files related to MySQL:
shell>> locate mysql
Output:
/etc/mysql
/etc/apparmor.d/usr.sbin.mysqld
/etc/apparmor.d/abstractions/mysql
/etc/apparmor.d/cache/usr.sbin.mysqld
/etc/apparmor.d/cache/usr.sbin.mysqld-akonadi
/etc/apparmor.d/local/usr.sbin.mysqld
/etc/bash_completion.d/mysqladmin
/etc/init/mysql.conf
/etc/logcheck/ignore.d.paranoid/mysql-server-5_5
/etc/logcheck/ignore.d.server/mysql-server-5_5
/etc/logcheck/ignore.d.workstation/mysql-server-5_5
/etc/logrotate.d/mysql-server
/etc/mysql/conf.d
/etc/mysql/debian-start
/etc/mysql/debian.cnf
/etc/mysql/conf.d/mysqld_safe_syslog.cnf
/home/pkr/.mysql_history
/home/pkr/.cache/software-center/piston-helper/rec.ubuntu.com,api,1.0,recommend_app,libqt4-sql-mysql,,349051c3a57da571aa832adb39177aff
/home/pkr/.cache/software-center/piston-helper/rec.ubuntu.com,api,1.0,recommend_app,mysql-client,,cbf77a486cdc80547317981a33144427
/home/pkr/.cache/software-center/piston-helper/rec.ubuntu.com,api,1.0,recommend_app,mysql-client,,de8220dee4d957a9502caa79e8d2fdda
/home/pkr/.cache/software-center/rnrclient/reviews.ubuntu.com,reviews,api,1.0,reviews,filter,en,any,any,any,libqt4-sql-mysql,page,1,helpful,,17fb2e657321dc51526ee8fe9928da30
/home/pkr/.cache/software-center/rnrclient/reviews.ubuntu.com,reviews,api,1.0,reviews,filter,en,any,any,any,mysql-client,page,1,helpful,,a4c1b6e8200f36ab5745c6f81f14da0a
/home/pkr/.cache/software-center/rnrclient/reviews.ubuntu.com,reviews,api,1.0,reviews,filter,en,ubuntu,oneiric,any,libqt4-sql-mysql,page,1,helpful,,c54295fb82b8183350cd34f22c3547ef
/home/pkr/.cache/software-center/rnrclient/reviews.ubuntu.com,reviews,api,1.0,reviews,filter,en,ubuntu,oneiric,any,mysql-client,page,1,helpful,,fcf201c1abff3f774af89173a84de2cc
/home/pkr/.cache/software-center/rnrclient/reviews.ubuntu.com,reviews,api,1.0,reviews,filter,en,ubuntu,precise,any,libqt4-sql-mysql,page,1,helpful,,0cd86648584efeccfb16119012f89540
/home/pkr/.cache/software-center/rnrclient/reviews.ubuntu.com,reviews,api,1.0,reviews,filter,en,ubuntu,precise,any,mysql-client,page,1,helpful,,eb84724e9da7851ff8862a227d8bac59
/home/pkr/.local/share/akonadi/mysql.conf
/home/pkr/.local/share/akonadi/db_data/mysql
/home/pkr/.local/share/akonadi/db_data/mysql.err
/home/pkr/.local/share/akonadi/db_data/mysql.err.old
/home/pkr/.local/share/akonadi/db_data/mysql/columns_priv.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/columns_priv.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/columns_priv.frm
/home/pkr/.local/share/akonadi/db_data/mysql/db.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/db.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/db.frm
/home/pkr/.local/share/akonadi/db_data/mysql/event.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/event.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/event.frm
/home/pkr/.local/share/akonadi/db_data/mysql/func.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/func.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/func.frm
/home/pkr/.local/share/akonadi/db_data/mysql/general_log.CSM
/home/pkr/.local/share/akonadi/db_data/mysql/general_log.CSV
/home/pkr/.local/share/akonadi/db_data/mysql/general_log.frm
/home/pkr/.local/share/akonadi/db_data/mysql/help_category.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/help_category.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/help_category.frm
/home/pkr/.local/share/akonadi/db_data/mysql/help_keyword.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/help_keyword.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/help_keyword.frm
/home/pkr/.local/share/akonadi/db_data/mysql/help_relation.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/help_relation.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/help_relation.frm
/home/pkr/.local/share/akonadi/db_data/mysql/help_topic.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/help_topic.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/help_topic.frm
/home/pkr/.local/share/akonadi/db_data/mysql/host.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/host.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/host.frm
/home/pkr/.local/share/akonadi/db_data/mysql/ndb_binlog_index.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/ndb_binlog_index.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/ndb_binlog_index.frm
/home/pkr/.local/share/akonadi/db_data/mysql/plugin.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/plugin.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/plugin.frm
/home/pkr/.local/share/akonadi/db_data/mysql/proc.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/proc.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/proc.frm
/home/pkr/.local/share/akonadi/db_data/mysql/procs_priv.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/procs_priv.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/procs_priv.frm
/home/pkr/.local/share/akonadi/db_data/mysql/proxies_priv.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/proxies_priv.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/proxies_priv.frm
/home/pkr/.local/share/akonadi/db_data/mysql/servers.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/servers.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/servers.frm
/home/pkr/.local/share/akonadi/db_data/mysql/slow_log.CSM
/home/pkr/.local/share/akonadi/db_data/mysql/slow_log.CSV
/home/pkr/.local/share/akonadi/db_data/mysql/slow_log.frm
/home/pkr/.local/share/akonadi/db_data/mysql/tables_priv.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/tables_priv.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/tables_priv.frm
/home/pkr/.local/share/akonadi/db_data/mysql/time_zone.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/time_zone.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/time_zone.frm
/home/pkr/.local/share/akonadi/db_data/mysql/time_zone_leap_second.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/time_zone_leap_second.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/time_zone_leap_second.frm
/home/pkr/.local/share/akonadi/db_data/mysql/time_zone_name.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/time_zone_name.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/time_zone_name.frm
/home/pkr/.local/share/akonadi/db_data/mysql/time_zone_transition.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/time_zone_transition.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/time_zone_transition.frm
/home/pkr/.local/share/akonadi/db_data/mysql/time_zone_transition_type.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/time_zone_transition_type.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/time_zone_transition_type.frm
/home/pkr/.local/share/akonadi/db_data/mysql/user.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/user.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/user.frm
/usr/bin/mysql
/usr/bin/mysql_install_db
/usr/bin/mysql_upgrade
/usr/bin/mysqlcheck
/usr/sbin/mysqld
/usr/share/mysql
/usr/share/app-install/desktop/gmysqlcc:gmysqlcc.desktop
/usr/share/app-install/desktop/mysql-client.desktop
/usr/share/app-install/desktop/mysql-navigator:mysql-navigator.desktop
/usr/share/app-install/desktop/mysql-server.desktop
/usr/share/app-install/icons/gmysqlcc-32.png
/usr/share/app-install/icons/mysql-navigator.png
/usr/share/doc/mysql-client-core-5.5
/usr/share/doc/mysql-server-core-5.5
/usr/share/kde4/apps/katepart/syntax/sql-mysql.xml
/usr/share/man/man1/mysql.1.gz
/usr/share/man/man1/mysql_install_db.1.gz
/usr/share/man/man1/mysql_upgrade.1.gz
/usr/share/man/man1/mysqlcheck.1.gz
/usr/share/man/man8/mysqld.8.gz
/var/cache/apt/archives/akonadi-backend-mysql_1.7.2-0ubuntu1_all.deb
/var/cache/apt/archives/libmysqlclient-dev_5.5.22-0ubuntu1_i386.deb
/var/cache/apt/archives/libmysqlclient18_5.5.22-0ubuntu1_i386.deb
/var/cache/apt/archives/libqt4-sql-mysql_4%3a4.8.1-0ubuntu4.1_i386.deb
/var/cache/apt/archives/mysql-client-5.5_5.5.22-0ubuntu1_i386.deb
/var/cache/apt/archives/mysql-client-core-5.5_5.5.22-0ubuntu1_i386.deb
/var/cache/apt/archives/mysql-client_5.5.22-0ubuntu1_all.deb
/var/cache/apt/archives/mysql-common_5.5.22-0ubuntu1_all.deb
/var/cache/apt/archives/mysql-server-5.5_5.5.22-0ubuntu1_i386.deb
/var/cache/apt/archives/mysql-server-core-5.5_5.5.22-0ubuntu1_i386.deb
/var/cache/apt/archives/mysql-server_5.5.22-0ubuntu1_all.deb
/var/lib/dpkg/info/mysql-client-core-5.5.list
/var/lib/dpkg/info/mysql-client-core-5.5.md5sums
/var/lib/dpkg/info/mysql-server-5.5.list
/var/lib/dpkg/info/mysql-server-5.5.postrm
/var/lib/dpkg/info/mysql-server-core-5.5.list
/var/lib/dpkg/info/mysql-server-core-5.5.md5sums
/var/log/mysql
/var/log/mysql.err
/var/log/mysql.log
/var/log/mysql.log.1.gz
/var/log/mysql.log.2.gz
/var/log/mysql.log.3.gz
/var/log/mysql.log.4.gz
/var/log/mysql.log.5.gz
/var/log/mysql.log.6.gz
/var/log/mysql.log.7.gz
/var/log/upstart/mysql.log.1.gz
/var/log/upstart/mysql.log.2.gz
/var/log/upstart/mysql.log.3.gz
/var/log/upstart/mysql.log.4.gz
/var/log/upstart/mysql.log.5.gz
/var/log/upstart/mysql.log.6.gz
/var/log/upstart/mysql.log.7.gz
What should I do now?
I am trying to find out if there is any way I can remove all MySQL related files and then re-install MySQL.
I need it for Qt connectivity.
With the command:
sudo apt-get remove --purge mysql\*
you can delete anything related to packages named mysql. Those commands are only valid on debian / debian-based linux distributions (Ubuntu for example).
You can list all installed mysql packages with the command:
sudo dpkg -l | grep -i mysql
For more cleanup of the package cache, you can use the command:
sudo apt-get clean
Also, remember to use the command:
sudo updatedb
Otherwise the "locate" command will display old data.
To install mysql again, use the following command:
sudo apt-get install libmysqlclient-dev mysql-client
This will install the mysql client, libmysql and its headers files.
To install the mysql server, use the command:
sudo apt-get install mysql-server
Just a little addition to the answer of @dAm2k :
In addition to sudo apt-get remove --purge mysql\*
I've done a sudo apt-get remove --purge mariadb\*
.
I seems that in the new release of debian (stretch), when you install mysql it install mariadb package with it.
Hope it helps.