Skip to content

Error:SQLSTATE[HY000] [2002] No such file or directory #26

Closed
@twbworld

Description

@twbworld

Github-Actions Config

jobs:
  test:
    runs-on: ubuntu-20.04
    steps:
      - uses: actions/checkout@v2
      - uses: php-actions/composer@v5
      - uses: php-actions/phpunit@v2
        with:
          configuration: ./phpunit.xml
          version: 9.5.2
          php_version: 7.4
          php_extensions: xdebug mbstring mysqli pdo_mysql

PHP

try {
    $dsn = 'mysql:dbname=mysql;host=localhost';
    $db = new \PDO($dsn, 'root', 'root');
    $db->exec('set names utf8');
} catch (\PDOException $e) {
    echo '数据库连接失败丫 : ' . $e->getMessage();
}

Error

..E数据库连接失败丫 : SQLSTATE[HY000] [2002] No such file or directory

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions