Laravel error sqlstate[hy000] [2002] No such file or directory

Source: Internet
Author: User

PHP Artisan migrate times error in Mac

SQLSTATE[HY000] [2002] No such file or directory (Sql:select * from information_schema.tables where table_schema = Weifen Xiao and table_name = migrations)

[Pdoexception]
SQLSTATE[HY000] [2002] No such file or directory

This is due to the fact that the Mysql.sock file could not be found.

1. Execute SQL statement inside MySQL show variables like '%sock% '

2. The corresponding value of the field corresponding to the result returned by the socket, the general result probably looks like this/tmp/mysql.sock

3. Modify the file./config/database.php in the connections under MySQL add

‘unix_socket’ => ‘/tmp/mysql.sock’

So that we can execute the

Laravel error sqlstate[hy000] [2002] No such file or directory

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.