Connection error after switching from XAMPP to MySQL (installed in homebrew)

Asked 2 years ago, Updated 2 years ago, 89 views

I was using XAMPP a while ago, but after installing MySQL with homebrew and brew services stop mysql command, I received the following error when connecting with mysql-uroot:

ERROR2002(HY000): Can't connect to local MySQL server through socket'/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock'(2 "No such file or directory")

This error appears in sudo touch/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock
It was resolved by doing so, but then mysql-uroot changed to the following error:

Can't connect to local MySQL server through socket'/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock' (38 "Socket operation on non-socket")

I have checked the .local.err file, but it cannot be resolved, so I would like to ask you a question.

What is the cause of the error? When I type the mysql command, is it because I try to connect to XAMPP?

This may be an ignorant and uninformed question about the development environment, but I would appreciate it if you could give me a solution or a hint.

mysql macos homebrew

2022-09-30 19:21

1 Answers

I think it is wrong to create a file with touch for the first "mysql.sock not found".
Because socket files are special files created by the process, creating them manually using the touch command is not an appropriate response.

If you still have an existing XAMPP environment, check the path using which mysql to see if mysql refers to XAMPP or homebrew.

"After installing on homebrew, it says ""brew services stop mysql"", but I think I should stop what I installed with XAMPP, and the command to execute is different."

In order to avoid confusion, if possible, it would be better to uninstall MySQL that you installed with your existing XAMPP.


2022-09-30 19:21

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.