How do you uninstall MySQL from Mac OS X?

MysqlMacosOsx Snow-Leopard

Mysql Problem Overview


I accidentally installed the PowerPC version of MySQL on my Intel Mac in Snow Leopard, and it installed without a problem but of course doesn't run properly. I just didn't pay enough attention. Now when I try to install the correct x86 version it says that it can't install because a newer version is already installed. A Google query led me to perform these actions/delete these files to uninstall it:

sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/MySQL*
rm -rf ~/Library/PreferencePanes/MySQL*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*

And finally removed the line MYSQLCOM=-YES- from /etc/hostconfig

They haven't seemed to help at all. I am still receiving the same message about there being a newer version. I tried installing an even newer version (the current Beta) and it also gave me the same message about a newer version already being installed. I can't uninstall it from the Prefs Pane because I never installed the PrefPane also.

Mysql Solutions


Solution 1 - Mysql

Try running also

sudo rm -rf /var/db/receipts/com.mysql.*

Solution 2 - Mysql

I also had entries in:

/Library/Receipts/InstallHistory.plist

that i had to delete.

Solution 3 - Mysql

If you installed mysql through brew then we can use command to uninstall mysql.

$ brew uninstall mysql

Uninstalling /usr/local/Cellar/mysql/5.6.19...

This worked for me.

Solution 4 - Mysql

ps -ax | grep mysql

*stop and kill any MySQL processes

brew remove mysql
brew cleanup

sudo rm /usr/local/mysql
sudo rm -rf /usr/local/var/mysql
sudo rm -rf /usr/local/mysql*
sudo rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/MySql*

launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

edit /etc/hostconfig and remove the line MYSQLCOM=-YES-

rm -rf ~/Library/PreferencePanes/My*    
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /private/var/db/receipts/*mysql*

*restart your computer just to ensure any MySQL processes are killed try to run mysql, it shouldn't work

Solution 5 - Mysql

Aside from the long list of remove commands in your question, which seems quite comprehensive in my recent experience of exactly this issue, I found mysql.sock running in /private/var and removed that. I used

find / -name mysql -print 2> /dev/null

...to find anything that looked like a mysql directory or file and removed most of what came up (aside from Perl/Python access modules). You may also need to check that the daemon is not still running using Activity Monitor (or at the command line using ps -A). I found that mysqld was still running even after deleting the files.

Solution 6 - Mysql

OS version: 10.14.6 MYSQL version: 8.0.14

Goto System preferences -> MYSQLenter image description here

Stop MySQL server

enter image description here

One option will be shown here to uninstall MYSQL 8 after stopping Mysql server

Solution 7 - Mysql

I also had a config file at /etc/my.cnf that I needed to delete on my Mac OS X Snow Leopard install

Solution 8 - Mysql

It might be overkill but your MySQL command history can also be wiped from:

~/.mysql_history

Solution 9 - Mysql

You need to identify where MySQL was installed to before attempting to delete it.

I always use the Hivelogic guide to installing under Mac OS X which builds MySQL from source. When setting up the build you can specify a directory under which to install MySQL with the --prefix parameter. You should make sure the directory does not exist and attempt to install from source.

./configure --prefix=/usr/local/mysql --with-extra-charsets=complex \
--enable-thread-safe-client --enable-local-infile --enable-shared \
--with-plugins=innobase

Solution 10 - Mysql

You should also check /var/db/receipts and remove all entries that contain com.mysql.*

Using sudo rm -rf /var/db/receipts/com.mysql.* didn't work for me. I had to go into var/db/receipts and delete each one seperately.

Solution 11 - Mysql

This did the job for me:

brew uninstall mysql

Solution 12 - Mysql

For me, I had installed MariaDB years ago using homebrew. Correct uninstall procedure was: brew uninstall mariadb.

Solution 13 - Mysql

I also found

/Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist

after using all of the other answers here to uninstall MySQL Community Server 8.0.15 from OS X 10.10.

Solution 14 - Mysql

Remove MySQL completely

Open the Terminal

Use mysqldump to backup your databases

Check for MySQL processes with:

ps -ax | grep mysql

Stop and kill any MySQL processes

Analyze MySQL on HomeBrew:

brew remove mysql
brew cleanup

Remove files:

sudo rm /usr/local/mysql
sudo rm -rf /usr/local/var/mysql
sudo rm -rf /usr/local/mysql*
sudo rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*

Unload previous MySQL Auto-Login:

launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

Remove previous MySQL Configuration:

subl /etc/hostconfig` 
# Remove the line MYSQLCOM=-YES-

Remove previous MySQL Preferences:

rm -rf ~/Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /private/var/db/receipts/*mysql*

Restart your computer just to ensure any MySQL processes are killed

Try to run mysql, it shouldn't work

Solution 15 - Mysql

sudo find / | grep -i mysql

This worked like a charm for me. Just went through the list and ensured that anything MySQL related was deleted.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJoseph RavenwolfeView Question on Stackoverflow
Solution 1 - MysqlSophie AlpertView Answer on Stackoverflow
Solution 2 - Mysqlrm-rfView Answer on Stackoverflow
Solution 3 - MysqlbapuView Answer on Stackoverflow
Solution 4 - MysqlVictorView Answer on Stackoverflow
Solution 5 - Mysqlmblackwell8View Answer on Stackoverflow
Solution 6 - Mysqlmaulik trapasiyaView Answer on Stackoverflow
Solution 7 - MysqlDirk de KokView Answer on Stackoverflow
Solution 8 - MysqlmhoeffnerView Answer on Stackoverflow
Solution 9 - MysqlBrian LyttleView Answer on Stackoverflow
Solution 10 - MysqlDaveView Answer on Stackoverflow
Solution 11 - MysqlSriniView Answer on Stackoverflow
Solution 12 - MysqlrmcView Answer on Stackoverflow
Solution 13 - Mysqlfloat13View Answer on Stackoverflow
Solution 14 - MysqlMarkandayan PView Answer on Stackoverflow
Solution 15 - MysqlPaulDView Answer on Stackoverflow