-
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:
# Edit this file: /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
-
Star
(958)
You must be signed in to star a gist -
Fork
(225)
You must be signed in to fork a gist
-
-
Save vitorbritto/0555879fe4414d18569d to your computer and use it in GitHub Desktop.
Helped a lot, thank you!
After long searching , i solved this issue , downloaded official mac os community file from :- https://dev.mysql.com/downloads/file/?id=492745
it worked for mac os Catalina 10.15 , check this link :- https://dev.mysql.com/doc/mysql-osx-excerpt/5.7/en/osx-installation-pkg.html , they also mentioned required packages to run mysql on mac os , specially "/tmp/mysql.sock" at bottom .
Saved my behind.
This was very helpful. I also had to do:
rm /usr/local/etc/my.cnf
Something I had done previously had resulted in a
my.cnf
file that prevented MySQL from working (I was getting the dreadedERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
error).
Apparently, this config file can live in several places: /etc/my.cnf, OR /etc/mysql/my.cnf OR ~/.my.cnf. My particular install had placed it at /etc/my.cnf as well, but thought I'd drop the other options here in case anybody else is down this same rabbit hole as me one day.
Thanks to OP @vitorbritto for the great gist as well!
Thanks, it worked :-)
Thanks
how do we do step 8... removing the line part
Thanks a lot. It would have been good if I got this article first. I would have saved about 5 hours :-(
Thank you so much. I wish I had landed up on this page much earlier. I struggled so much. This is an excellent page, Thanks π
Thank you! Very helpful!
Thank you very much. It is notoriously difficult to uninstall mysql data. Your tutorial did the trick! π
subl /etc/hostconfig`
has a hanging backtick
π
thank you very much
Thank you , it's help a lot !
Aaah, Thanks man!
Thank you
Nice work! Thank you
subl /etc/hostconfig`
has a hanging backtick
Also, not everyone has sublime text. Better to simply say "edit this file".
This is very helpful! Thank you!
On the Apple Silicon:
brew remove mysql
rm -rf /opt/homebrew/var/mysql
brew install mysql
mysql.server start
mysql -uroot
subl /etc/hostconfig`
has a hanging backtickAlso, not everyone has sublime text. Better to simply say "edit this file".
Thanks @commadelimited, gist updated.
subl /etc/hostconfig`
has a hanging backtick
Thanks @lexjacobs, gist updated.
When setting up my Apple M1 Macbook Pro I was experiencing the issue of the following error message being thrown:
Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
My fix was to modify the MySQL config file:
nano /usr/local/etc/my.cnf
Append the following lines:
tmpdir=/tmp
user=root
Then run:
brew services restart [email protected]
This fixed my issue, and I was then able to connect successfully with my DB client.
@seemly Thanks for this
Thanks <3
This was very helpful. I also had to do:
rm /usr/local/etc/my.cnf
Something I had done previously had resulted in a
my.cnf
file that prevented MySQL from working (I was getting the dreadedERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
error).
Thank you! This was what I needed!
Awesome Thanks πππ»
saved my day! Thank you :)
Thanks this got it all working!