-
-
Save lucascaton/3373792 to your computer and use it in GitHub Desktop.
Reinstalling MySQL 5.x on macOS via Homebrew
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brew remove mysql | |
brew cleanup | |
launchctl unload -w ~/Library/LaunchAgents/com.mysql.mysqld.plist | |
rm ~/Library/LaunchAgents/com.mysql.mysqld.plist | |
sudo rm -rf /usr/local/var/mysql | |
brew install mysql | |
unset TMPDIR | |
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp | |
mkdir -p ~/Library/LaunchAgents | |
cp /usr/local/Cellar/mysql/5.5.25a/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/ | |
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist | |
# Success! :-) |
I am using M3.
But I have this error: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Can you help me with that?
@hendisantika, it seems your MySQL isn't running.
- What's the output of
brew services list
? - What's the output when you start MySQL?
- What steps have you tried so far? Maybe one listed above?
What's the output of brew services list?
brew services list
Name Status User File
alloy none
colima error 1 hendisantika ~/Library/LaunchAgents/homebrew.mxcl.colima.plist
consul started hendisantika ~/Library/LaunchAgents/homebrew.mxcl.consul.plist
grafana-agent none
mysql started hendisantika ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
php none
podman none
postgresql@17 started hendisantika ~/Library/LaunchAgents/homebrew.mxcl.postgresql@17.plist
redis started hendisantika ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
unbound none
vault none
What's the output when you start MySQL?
hendisantika@Hendis-MacBook-Pro ~ % mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (38)
What steps have you tried so far? Maybe one listed above?
- Remove mysql
- Reinstall MySQL
- Still error
@hendisantika, sorry - I don't know what the problem is π
OIC
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@MikKuba, @giovannievway, I had to uninstall it, delete all the data, and re-install it to get it working again π
Then, to check, I ran
brew services list
:Hope this solves the issue for you too π