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

Source: Internet
Author: User
Tags mysql client

Rhel 6.5 + MySQL 5.6 compiled and installed.

The installation process was smooth.


--datadir=/data/project/db1/mysql/data

--datadir=/data/project/db1/mysql/data

--socket=/tmp/mysql.sock


The my.cnf file is placed in the /data/project/db1/mysql/data.

Start normally.

Using MySQL to connect to the server, error:

[ [email protected]  /data/project/db1/mysql]# mysql -uroot
ERROR  2002  (HY000):  can ' t connect to local mysql server through  socket  '/var/lib/mysql/mysql.sock '   (2)


Check MY.CNF configuration, did not find problems, tossing a long time (online also search, have not found the root cause of the problem), found that the local server was installed before the binary MySQL client program. Installed through Yum. Uninstall the MySQL client.

#yum Erase MySQL

Again login MSYQL server try, everything OK. No longer prompt for errors.


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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.