-
-
Save lucascaton/3373792 to your computer and use it in GitHub Desktop.
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! :-) |
@MikKuba @lucascaton have you found a solution?
Hi @lucascaton , please, can you review script for actualization for macos Sonoma with M1 chip? Will be very glad. I just ruined my brew mysql service and anything can`t repair it.
Because I am working on several projects, for some I use brew mysql, for some MAMP mysql server and some Docker. When I came back to brew mysql after some days, mysql not running: "ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)"
My solution is to little change /etc/my.cnf
. If I am using MAMP, I have to comment these rows:
[mysqld]
#socket = /tmp/mysql.sock
#datadir = /opt/homebrew/var/mysql
#tmpdir = /tmp
and MAMP is running.
To start mysql via brew, I have to uncomment rows above.
After that I have to delete files in /opt/homebrew/var/mysql/ib_logfile0
and ib_logfile1
And now its only to restart brew mysql and everything running fine.
@MikKuba, @giovannievway, I had to uninstall it, delete all the data, and re-install it to get it working again 🙂
brew uninstall mysql@8.0
rm -rf /opt/homebrew/var/mysql
brew install mysql@8.0
Then, to check, I ran brew services list
:
Name Status User File
mysql@8.0 started [myuser] ~/Library/LaunchAgents/homebrew.mxcl.mysql@8.0.plist
# (others)
Hope this solves the issue for you too 🍀
@MikKuba, I'm having exactly the same issue right now (with MySQL 8) 😞