Can't connect to MYSQL Database Error

22 days ago

Effec7
Member | 1
+
0
-

Heyo Guys,

I would need your help with setting up the database connection. I followed the guide on your site, set the config.local.neon and homepagepresenter.php exactly like in the tutorial, yet, I get the error:

SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client

<?php

namespace App\Presenters;

use Nette;


class HomepagePresenter extends Nette\Application\UI\Presenter
{
    private $database;

    public function __construct(Nette\Database\Context $database)
    {
        $this->database = $database;
    }

    public function renderDefault()
    {
        $this->template->posts = $this->database->table('posts')
            ->order('created_at DESC')
            ->limit(5);
    }

    // ...
}

?>

Do you know is could be a problem?

Many thanks,
Daniel B.

22 days ago

David Matějka
Moderator | 5702
+
0
-

I assume you are using mysql >= 8.0.4? if so, it is possibly related to this authentication change . there are many discussions on stackoverflow or gh and other sites, which might help you. e.g. this one: https://github.com/…/issues/1392