Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure MariaDB in Laravel 5?

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.

like image 572
Parthapratim Neog Avatar asked Jul 27 '15 10:07

Parthapratim Neog


1 Answers

'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.

like image 115
Parthapratim Neog Avatar answered Oct 12 '22 22:10

Parthapratim Neog