• 0
  • 新人请关照

swoole mysql协程客户端connect错误?

按照官方给的代码,但是就是没法正常运行。
报错并且数据库也没法访问:

WARNING swManager_check_exit_status: worker#0[pi
d=2816] abnormal exit, status=127, signal=0
$http = new Swoole\Http\Server("127.0.0.1", 80);

$http->on('request', function ($request, $response) {
    
    $db = new Swoole\Coroutine\MySQL();
    $res = $db->connect([
        'host' => '127.0.0.1',
        'port' => 3306,
        'user' => 'root',
        'password' => '123456',
        'database' => 'test',
    ]);
    $data = $db->query('select * from users');
    $response->end(json_encode($data));
});

$http->start();

求指教

阅读 292
评论
    0 个回答
    撰写回答

    登录后参与交流、获取后续更新提醒