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 > Database >
Share
Shulou(Shulou.com)06/01 Report--
Today, after setting up the database for the new business line, I reported an error at startup.
Root@qsbilldatahis-db01:/usr/local/mysql/bin#. / mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket'/ var/run/mysqld/mysqld.sock' (2)
For the record here, I hope to be able to provide the brothers who encounter this problem with a way to solve the problem. After having a train of thought, it will be easier to sort out the problem step by step, but my question is rather strange. If there are brothers who understand it, don't hesitate to give me advice.
First, let's introduce the environment in which this problem occurs:
Operating system: Ubuntu 14.04.5
The database version is: 5.6.39-log
Database installation is binary installation.
Fault phenomenon
Start the error report after database initialization
Root@qsbilldatahis-db01:/usr/local/mysql/bin#. / mysqlERROR 2002 (HY000): Can't connect to local MySQL server through socket'/ var/run/mysqld/mysqld.sock' (2)
Troubleshooting
Let's see if the database process starts.
This error will also be reported if the database process is not started
The process exists.
Second, look at the configuration of the socket file in the configuration file, and check whether the socket file exists and whether the permissions are correct.
The location of the socket file in the configuration file is configured under / tmp/mysql.sock
However, in the error report, go to the / var/run/mysqld/mysqld.sock location to find the configuration file, indicating that the configuration file does not take effect, but for example, the directory of other data files and log files is already in effect.
Third, see if valuable information is provided in the error log.
Check that there are no related errors in the error log
Troubleshooting:
The cause of the problem has not been found. When you flip up the session, you will see the following output after the database initialization is completed.
Is it because the configuration file in another location was read when the database was started?
I started with the following command and have specified the location of the configuration file
. / mysqld_safe-- defaults-file=/etc/my.cnf &
View / etc/mysql/my.cnf
I did find the location of socket in this configuration file.
After renaming the configuration file under the / etc/mysql path
Oot@qsbilldatahis-db01:/etc/mysql# cd / etc/mysql/root@qsbilldatahis-db01:/etc/mysql# lsconf.d my.cnfroot@qsbilldatahis-db01:/etc/mysql# mv my.cnf my.cnf_bak
Re-enter the mysql command line did not report an error, the problem is solved
Fault summary
You can view the default order in which MySQL database reads configuration files with the following command
As a matter of fact, I still wonder why I will read the configuration files of other locations when I have a profile bag location. The output after database initialization is reflected.
This is the problem solving, which is to rename the configuration file under other paths.
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.