Ubuntu remove mysql
Publisher: Psychz Networks, October 04,2015There are times when we need to remove a version of mysql to replace it with another, or need to remove a conflicting copy of the same program.
The Ubuntu dpkg-query command can be used to pull up information pertaining to installed packages. Here's an outpout of all of the installated packages of mysql.
root@localhost:~# dpkg --list |grep mysql
ii libmysqlclient18:amd64 5.5.44-0ubuntu0.14.04.1 amd64 MySQL database client library
ii mysql-client-core-5.6 5.6.19-0ubuntu0.14.04.1 amd64 MySQL database core client binaries
ii mysql-common 5.5.44-0ubuntu0.14.04.1 all MySQL database common files, e.g. /etc/mysql/my.cnf
rc mysql-server-5.5 5.5.44-0ubuntu0.14.04.1 amd64 MySQL database server binaries and system database setup
ii mysql-server-core-5.5 5.5.44-0ubuntu0.14.04.1 amd64 MySQL database server binaries
As you can see here we have two copies of the MYSQL 5.5. and 5.6, that can potentially cause conflicts amongst LAMP stack applications. To remove the version of mysql-5.6 that is conflicting with your programs we'll run the following command.
root@localhost:~# dpkg -r mysql-client-core-5.6
(Reading database ... 54555 files and directories currently installed.)
Removing mysql-client-core-5.6 (5.6.19-0ubuntu0.14.04.1) ...
Processing triggers for man-db (2.6.7.1-1) ...
Now lets check again if we remove the correct file.
root@localhost:~# dpkg --list | grep mysql
ii libdbd-mysql-perl 4.025-1 amd64 Perl5 database interface to the MySQL database
ii libmysqlclient18:amd64 5.5.44-0ubuntu0.14.04.1 amd64 MySQL database client library
ii mysql-common 5.5.44-0ubuntu0.14.04.1 all MySQL database common files, e.g. /etc/mysql/my.cnf
rc mysql-server-5.5 5.5.44-0ubuntu0.14.04.1 amd64 MySQL database server binaries and system database setup
ii mysql-server-core-5.5 5.5.44-0ubuntu0.14.04.1 amd64 MySQL database server binaries
Flags to know when using the DPKG command.
- u - unknown
- i - install
- r - remove/deinstall
- p - urge (remove including config files)
- h - hold
Now you have all the tools to remove mysql or any other program on a debian/Ubuntu machine.