If you encounter a problem, the methods provided on the Internet are not easy to use. ask for advice.

Source: Internet
Author: User
If you encounter a problem, it is difficult to use the methods provided on the internet. ask Warning: mysqli_real_connect (): (HY000/2002): No such file or directory in


Reply to discussion (solution)

Too little information is provided

For some reason mysql on OS x gets the locations of the required socket file a bit wrong, but thanks to a veritable wizard I know (that's you, Gavin) the solution is as simple as setting up a symbolic link.

You may have a socket (appearing as a zero length file) as/tmp/mysql. sock or/var/mysql. sock but 1 or more apps is looking in the other location for it.

Rather than move the socket and have to edit config files and remember to keep edited files local and away from servers where the paths are correct, simply create a symbolic link so your mac finds the required socket, even when it's looking in the wrong place!

If you have/tmp/mysql. sock but no/var/mysql. sock then...

cd /var sudo mkdir mysqlsudo chmod 755 mysqlcd mysqlln -s /tmp/mysql.sock mysql.sock


If you have/var/mysql. sock but no/tmp/mysql. sock then

cd /tmpln -s /var/mysql/mysql.sock mysql.sock


You will need permissions to create the directory and link, so just prefix the commands above with sudo if necessary.

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.