MySql Install Error: Can‘t connect to local MySQL server through socket ‘/tmp/mysql.sock‘

@[TOC] (error 2002 (HY000): can’t connect to local MySQL server through socket ‘/ TMP/MySQL. Socket’)

System overview

CentOS 7 + MySql-community-release-el6-5.noarch。

Install MySQL process

First, download the RPM installation package as follows:
WGet – P/usr/software/
Then, run the following command to install the yum source:
RPM – IVH mysql-community-release-el-5. Noarch. RPM
after the yum source is installed, you can view it as follows:
ll/etc/yum. Repos. D/
if the yum source is installed correctly, It should be displayed:
total dosage 48
– rw-r – r–. 1 root 1664 November 23 2020 CentOS base. Repo
– rw-r – r–. 1 root 1309 November 23 2020 CentOS cr. repo
– rw-r – r–. 1 root 649 November 23 2020 CentOS debuginfo. Repo
– rw-r – r–. 1 root 314 November 23 2020 CentOS FastTrack. Repo
– rw-r – r–. 1 root 630 November 23 2020 Cen TOS media. Repo
– rw-r – r–. 1 root 1331 November 23 2020 CentOS sources. Repo
– rw-r – r–. 1 root 8515 November 23 2020 CentOS vault. Repo
– rw-r – r–. 1 root 616 November 23 2020 centos-x86_ Next, run the following command to install MySQL:
Yum – y install MySQL
at the end of the process, Run the following command to start MySQL service and report an error:
Service mysqld start
at this time, the error content is as shown in the question. After checking the above installation process with the following command, the packages to be installed are:
RPM – QA | grep MySQL
the packages to be seen at this time are as follows:
mysql-community-release-el6-5. Noarch
mysql-community-common-5.6.51-2. El6.x86_ 64
mysql-community-client-5.6.51-2.el6.x86_ 64
mysql-community-libs-5.6.51-2.el6.x86_ 64
you can see that there is no MySQL Server package in the above package. So next, install MySQL server with the following command:
Yum – y install MySQL server
after the above command is executed successfully, start MySQL service:
Service mysqld start
and then run:
MySQL – uroot to enter MySQL server.

Read More: