Since I am a beginner, I would appreciate it if you could point out any mistakes. It is posted for the purpose of memorandum and output.
Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
As a beginner, I suffered from this error many times.
Besides this error, I also suffered from errors such as Can't connect to local MySQL server through socket'/tmp/mysql.sock' (38) and ERROR! The server quit without updating PID file. Looking at the article, it was mentioned that (1) creation of PID file, (2) change of authority, and (3) reinstallation support were mentioned as countermeasures, but even if I tried various articles, it was useless. (Because I am a beginner, I think it is because I do not understand the article and the cause.) I would like to leave my solution as a reference for beginners who are similarly troubled. (Since the cause has not been understood yet, no explanation is given.) So, if you try it, please do so at your own risk.
In my case, I have mysql8.0 installed and it seems to cause inconvenience. So it will be uninstalled.
brew uninstall mysql
Type this command.
sudo rm -rf /usr/local/Cellar/mysql*
sudo rm -rf /usr/local/bin/mysql*
sudo rm -rf /usr/local/var/mysql*
sudo rm -rf /usr/local/etc/my.cnf
sudo rm -rf /usr/local/share/mysql*
sudo rm -rf /usr/local/opt/mysql*
sudo rm -rf /etc/my.cnf
Then install [email protected].
brew install [email protected]
After that, it will pass through the path, so export it as follows.
export PATH="/usr/local/opt/apr-util/bin:$PATH" >> ~/.bash_profile
export PATH="/usr/local/opt/[email protected]/bin:$PATH" >> ~/.bash_profile
source ~/.bash_profile
Then type mysql.server start.
mysql.server start
Will it be Starting MySQL .. SUCCESS !? I get this error every time I restart my computer, but in my case the above remedy can fix the error.
Recommended Posts