-
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
-
-
Save vitorbritto/0555879fe4414d18569d to your computer and use it in GitHub Desktop.
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 mysql@5.7
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 :)
Thank god for your beautiful ass mate, I was looking for this for like an hour
Thanks for this awesome guide.
@tnorthcutt's reply helped a lot!
Thanks, it worked!!
Thanks
nice
sudo rm -rf /opt/homebrew/etc/my.cnf
does the trick for me
it works, i remove MySQL 8 successfully.
Thanks
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 mysql@5.7
This fixed my issue, and I was then able to connect successfully with my DB client.
This works!
On the Apple Silicon:
brew remove mysql rm -rf /opt/homebrew/var/mysql brew install mysql mysql.server start mysql -uroot
just running this already fixed it for me
I installed mysql v5 through package.
How can I uninstall that?
Thanks it worked for me
Thanks, it help a lot
Great Job!!! It worked for me !!!
Thanks, it worked!
Thank you very much, finnaly this method is solved my problem!
OMG! Needed this for hours. Finally found this. Thank you!
Thnaks, it worked !
brew remove mysql rm -rf /opt/homebrew/var/mysql brew install mysql mysql.server start mysql -uroot
this would work , but I noticed that there is another version of mysql on my mac:
> mysql -V mysql Ver 14.14 Distrib 5.7.24, for osx11.1 (x86_64) using EditLine wrapper
Later use this command :type -a mysql
It shows that anaconda3 installed a old version automatically.Ops....
mysql is /opt/anaconda3/bin/mysql
Remove it , then reinstall.
@seemly god bless you! I spend about 8 hours to look for an answer that could help me
Thank you! You just saved my life with this tutorial!!!!!
brew remove mysql rm -rf /opt/homebrew/var/mysql brew install mysql mysql.server start mysql -uroot
this would work , but I noticed that there is another version of mysql on my mac:> mysql -V mysql Ver 14.14 Distrib 5.7.24, for osx11.1 (x86_64) using EditLine wrapper
Later use this command :type -a mysql
It shows that anaconda3 installed a old version automatically.Ops....mysql is /opt/anaconda3/bin/mysql
Remove it , then reinstall.
@martris Thank you
Thanks @lexjacobs, gist updated.