Databases

Easy steps to Remove MySQL in Ubuntu

In this article, we will see some easy steps to remove MySQL in Ubuntu.

If you want to remove a version of mysql to replace it with another or remove conflicting copy of the mysql, following steps will help.

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.

# 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-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, two copies of  MYSQL 5.5. And 5.6, which can potentially cause LAMP stack applications to conflict. We will run the following command in order to delete the version of mysql-5.6 that conflicts with your programs.

#  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.

# 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.

In this article, we have seen easy steps to remove MySQL in Ubuntu.

[Need assistance to fix this error or install tools? We’ll help you.]

Related Articles