Laravel 5.3 having problem of PDOExecption SQLSTATE[#4200]: <<Unknown error>>: 1044 Access denied for user 'xxx'@'%' to database '`xxx`;'

I am a newbie on web hosting. I can manage to access the website however when I submit login this error appear…

PDOException in MySqlConnector.php line 41:
SQLSTATE[#4200]: <>: 1044 Access denied for user ‘xxx’@’%’ to database ‘xxx;’

.env file

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=xxx
DB_USERNAME=xxx
DB_PASSWORD=xxx

MySqlConnector.php file

// Next we will set the “names” and “collation” on the clients connections so
// a correct character set will be used by this client. The collation also
// is set on the server but needs to be set here on this client objects.
if (isset($config[‘charset’])) {
$charset = $config[‘charset’];

        $names = "set names '{$charset}'".
            (! is_null($collation) ? " collate '{$collation}'" : '');
        $connection->prepare($names)->execute(); //This is line 41
    }

Screenshot of problem exception

Someone else posted similar and basically it isn’t supported here at 000webhost from the looks of it.

Else you need to visit general settings and change the phpversion to whatever the script requires.

I tried to modify the phpversion but not helping… i guess i have to find another hosting site then =( anyway thanks =)

Could ask at Laravel forums if they recognise the error and a solution I’ve never heard/used Laravel so can’t advise easily.

1 Like