Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I installed Mysql using sudo apt-get. Now I need to remove it from my system.

How can I do that?

share|improve this question

4 Answers 4

up vote 55 down vote accepted

To remove mysql completely from your system Just type in terminal

sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean
share|improve this answer
    
I guess this doesn't work. After I do these steps, I tried : sudo apt-get install mysql-client-core-5.5. But it shows : mysql-client-core-5.5 is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 97 not upgraded.. Is that mean still mysql resides in my pc? –  batman Aug 6 '12 at 9:35
    
Try sudo dpkg --purge mysql-server mysql-client mysql-common –  K.K Patel Aug 6 '12 at 10:46
    
If I try sudo dpkg --purge mysql-server mysql-client mysql-common I get : dpkg: warning: there's no installed package matching mysql-server dpkg: warning: there's no installed package matching mysql-client dpkg: warning: there's no installed package matching mysql-common . I'm bit confused now. Is that mysql have been removed or not? –  batman Aug 6 '12 at 11:17
    
Why does this remove xbmc and xbmc-bin as well? There are no xbmc tables in mysql when browsing with phpmyadmin. –  Redsandro Jan 16 at 17:47
    
this wasn't sufficient for me, a few more things had to be done: stackoverflow.com/a/16178696/447661 –  Mihai Rotaru Jul 26 at 21:07

all the above solutions are correct but I would try with

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

This will uninstall all mysql related packages.

share|improve this answer
2  
This is the easiest/simplest way to get rid of everything mysql-related. Though the wildcard here will match pretty much any package with 'mysq' in it's name, so you might want to specify sudo apt-get remove --purge -s 'mysql*' to be more specific. –  geerlingguy May 23 at 18:52

I don't use Ubuntu much but what I think you should try is what I did.

I first typed this in command line : sudo apt-get remove --purge mysql-server mysql-client mysql-common,

then followed with this below : sudo apt-get autoremove

and finally typed this : sudo apt-get autoclean.

I found that it was removed.

share|improve this answer

I forgot the mysql root password and needed to reset. I tried this http://www.rackspace.com/knowledge_center/article/mysql-resetting-a-lost-mysql-root-password and didn't work because it kept saying can't write logs or similar. Now my solution was to completely remove mysql from Ubuntu13.10 and fresh installation.

sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo rm -rf /var/lib/mysql

I had to run the last commandline, because Ubuntu sometimes keeps some libs even you try purge them all. Now install mysql server and client

sudo apt-get install mysql-client mysql-server
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.