如何在 Laravel 5 中配置 MariaDB? [英] How to configure MariaDB in Laravel 5?

查看:24
本文介绍了如何在 Laravel 5 中配置 MariaDB?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在某处读到,Laravel 5 中没有MariaDB"驱动程序,我们可以使用 mysql 驱动程序在 Laravel 5 中使用 MariaDB.但即便如此,当我提供我的 MariaDB 用户名和密码时,我也会收到此错误.密码是root",用户名也是root".

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)

有人可以指导我如何配置 MariaDB 以与 Laravel 5 一起使用.

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

推荐答案

'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,
    ],

嗯,问题出在端口上.默认情况下未提及,他们将其视为 3306.因此,我们必须包含该行并提及端口是 3307.这解决了问题.希望这会有所帮助.

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.

这篇关于如何在 Laravel 5 中配置 MariaDB?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆