In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "how to solve the problem that brew mysql cannot be connected". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Fault phenomenon
Today, the local project cannot be started. Check the log and find that the connection to the local database timed out. The error message is as follows:
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
Investigation process
First of all, look at the code, found that there is no change to the database-related content, suddenly appeared a little weird. On second thought, I wondered if there was something wrong with the database. Sure enough, the same error was reported when I used the database management tool Datagrip to connect, so I was basically sure that there was something wrong with mysql. First of all, check the status of the local mysql service installed by * * brew * *. There are three ways to check it:
Through the ps command
Ps-ef | grep mysql
Through the ps command plus grep filtering, you can see if there are any msyql processes in progress.
Through the lsof command
Lsof-iRu 3306
You can also use the lsof command to check whether the specified port is started. The default port I used when I created it at that time is port 3306. If you set another port, you can change it to the corresponding port.
View through brew's services (recommended)
Brew's services is used to manage backend service commands. It mainly has the following functions:
OK, just use the brew services command to see the status of mysql
You can see that there are usually three states listed, which are:
Stopped
Yellow started
Green started
There is nothing to say about stopped is that the service is turned off. What does the yellow and green started stand for respectively? First of all, the green started represents that the service is up and running. Yellow search for a long time, found that the unknown, that is to say, may be normal start, there may be problems, then why not directly show the unknown? It seems to be for compatibility, see this article [What is the meaning yellow service "started" status on Homebrew?-Stack Overflow] (https://stackoverflow.com/questions/41873704/what-is-the-meaning-yellow-service-started-status-on-homebrew/55798920 "What is the meaning yellow service" started "status on Homebrew?-Stack Overflow"). Unfortunately, this yellow is a glitch for me.
Solution method
Originally, I just wanted to restart it, but first restart the mysql service: brew services restart mysql, but it still didn't work after the restart. Then I reboot the computer, well, it still fails. Keep searching. I'm not alone in searching brew services yellow mysql on google. A lot of people gave solutions, but it took a long time to find something useful to me. Here are two directly posted.
Homebrew-brew services list shows mysql running but cannot connect-Stack Overflow
The solution is roughly to turn off the service, uninstall the service, delete the service data, upgrade the brew, and then reinstall the service. I mainly read his comments on the following two Thanks. I think it should be OK, but it still doesn't work. It may not be suitable for my situation.
Completely reinstall mysql
But the road of reinstallation is also very difficult, how can not start, there are other problems. It should not be uninstalled clean, and then it was solved according to this brew install mysql on macOS-Stack Overflow.
It is found that the remove & cleanup command was not used before, which may result in not uninstalling cleanly. Just follow the steps step by step.
This is the end of the content of "how to solve the problem that brew mysql can't connect". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.