4

I had downloaded the generic Linux 64 bit MySQL 5.6.17 TAR archive from http://dev.mysql.com/downloads/mysql/ and installed on my 64 bit Ubuntu 14.04, following the instructions at http://dev.mysql.com/doc/refman/5.6/en/binary-installation.html.

I am having some problems with the server, so i want to uninstall and do a fresh installation. But if i try the usual apt-get remove mysql-server(as per How do I uninstall Mysql?), i get :

Package 'mysql-server' is not installed, so not removed

I am guessing this is because i did not use apt-get to install in the first place. I had used scripts/mysql_install_db as per the instructions.

So is there some other way to uninstall MySQL server or is it ok to just delete the installation folder?

Edit

$ dpkg --get-selections | grep -v deinstall | grep "mysql"

gives the below result :

libdbd-mysql-perl               install
libmysqlclient18:amd64          install
mysql-client                    install
mysql-client-5.5                install
mysql-client-core-5.5           install
mysql-common                    install
mysql-workbench-community       install
4
  • Hi! I'm not too sure whether this will help but can you please try, dpkg --get-selections | grep -v deinstall | grep "mysql" and post the output if you see any packages or matches. This command will output packages relating to the word mysql while printing all the installed packages. :)
    – AzkerM
    May 26, 2014 at 5:40
  • I have updated the question with the output
    – faizal
    May 26, 2014 at 5:54
  • sudo apt-get remove mysql* May 26, 2014 at 5:57
  • AvinashRaj Exactly the same command that I was trying to comment on. @faizal please look into my answer
    – AzkerM
    May 26, 2014 at 6:02

4 Answers 4

4

Assuming you need to completely remove mysql related packages and its configs, please try below;

sudo apt-get remove --purge mysql*     # will remove all relating packages and its config
sudo apt-get autoremove               
sudo apt-get autoclean

And above command will completely remove all mysql related packages.

Hope it helps!!

5
  • Thanks AzkerM. But i am really nervous about doing this now. I have managed to make the existing MySQL work for now after a lot of experimenting. If i do face more problems, i will surely give this a try.
    – faizal
    May 26, 2014 at 6:19
  • It is always a best practice to make a use of official repo's available within Ubuntu unless you've no other choice. Anyhow, its your call & in any event we're always happy to help. :)
    – AzkerM
    May 26, 2014 at 6:21
  • I did not use the Ubuntu repo because it was downloading MySQL 5.5, while 5.6 was available for download from the mysql site. I have realized now that was an error of judgement :(
    – faizal
    May 26, 2014 at 6:48
  • 1
    Well there is a PPA for MySQL 5.6 given with an explanation on Launchpad which you should have tried. I also see certain bugs reported relating to this. Anyhow, there is no victory without pain. If your package is working and issues sorted, good to go though.
    – AzkerM
    May 26, 2014 at 7:22
  • A little side note is that I had to go to / to execute the remove --purge command. Standing in my home directory resulted in apt-get not being able to locate packages Dec 18, 2021 at 15:16
3

If you installed MYSql from .tar.gz file, you can't able to uninstall it through Ubuntu's native package management system (apt-get).

Find the uninstall.sh script inside the extracted directory and run it to completely remove all the files related to MYSQL.

3
  • Does such a script exist? I could not find it in my installation folder(find $MYSQL_HOME -name 'uninstall.sh')
    – faizal
    May 26, 2014 at 4:40
  • Most of the .tar.gz files comes with an un-installation script. I don't know about MYSQL. May 26, 2014 at 4:47
  • you right. The script is /root/oneinstack/uninstall.sh on my server.
    – ipcjs
    Mar 24, 2017 at 8:22
1

The following will uninstall everything that contain mysql.

apt-get remove --purge mysql*.*
apt-get autoremove
apt-get autoclean

Then run again the following to check any remaining packages.

dpkg --get-selections | grep -v deinstall | grep "mysql"

In my case, I only see mysql-common.

Reinstall and everything should work.

1
  • Superb. Works like charm. Apr 12, 2017 at 8:43
0

For me this worked, without putting myself at risk of removing core MySQL services.

sudo apt-get remove --purge mysql-workbench*

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .