The installation of mysql under centos7 and the installation of mysql under linux are different

Today, mysql was installed for a day, and finally installed after get off work at night. There have been various errors.
The reason why the error has been reported is actually because centos7 is only a series of linux, and linux is a large category. I searched for the method of installing mysql through linux, and found a lot of installation methods that are not suitable for me, mainly to report this error

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

In fact, when I saw this error, mysql has been installed, but it was caused by an access permission problem.
Just execute:

chown -R mysql:mysql /var/lib/mysql

Then restart is ok.
The specific installation process is as follows
1, download the yum source

wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

2.安装
sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm

After this step is performed, the installation is actually completed. If you encounter the above permission problem, you can install my solution to solve it.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325709166&siteId=291194637