How to configure MariaDB in Laravel 5?

Parthapratim Neog picture Parthapratim Neog · Jul 27, 2015 · Viewed 29.7k times · Source

I have read somewhere that, there is no driver for "MariaDB" in Laravel 5 and that we can use mysql driver to use MariaDB in Laravel 5. But even then I am getting this error when i give my MariaDB username and password. The password is "root" and username is also "root".

SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES)

Can someone guide me on how to configure MariaDB to be used with Laravel 5.

Answer

Parthapratim Neog picture Parthapratim Neog · Jul 28, 2015
'mysql' => [
        'driver'    => 'mysql',
        'host'      => env('DB_HOST', 'localhost'),
        'port'      => env('DB_PORT', '3307'),
        'database'  => env('DB_DATABASE', 'doctorsondemand'),
        'username'  => env('DB_USERNAME', 'root'),
        'password'  => env('DB_PASSWORD', 'root'),
        'charset'   => 'utf8',
        'collation' => 'utf8_unicode_ci',
        'prefix'    => '',
        'strict'    => false,
    ],

Well, the problem was with the port. By default it is not mentioned and they take it as 3306. So, we have to include that line and mention that the port is 3307. That solved the problem. Hope this helps.