laravel 5.6 SQLSTATE [HY000] [2002]连接在freash安装时被拒绝

时间:2018-03-23 03:21:26

标签: php mysql laravel homestead

我正在尝试设置一个新的laravel 5.6项目,而我目前在迁移数据库时遇到了问题。我已经摆弄了从localhost到127.etc的主机名和盒子IP。创建auth刀片后,我无法创建一个我收到的新用户 SQLSTATE [HY000] [2002]连接拒绝错误。 我试图登录该框以查看数据库中的内容,但是当我连接默认的宅基地U& P时,我得到了同样的错误。我也试过root / root但收到同样的错误。

这是部分数据库配置

    'mysql' => [
        'driver' => 'mysql',
        'host' => env('DB_HOST', '127.0.0.1'),
        'port' => env('DB_PORT', '3306'),
        'database' => env('DB_DATABASE', 'forge'),
        'username' => env('DB_USERNAME', 'forge'),
        'password' => env('DB_PASSWORD', ''),
        'unix_socket' => env('DB_SOCKET', ''),
        'charset' => 'utf8mb4',
        'collation' => 'utf8mb4_unicode_ci',
        'prefix' => '',
        'strict' => true,
        'engine' => null,
    ],

' redis的' => [

    'client' => 'predis',

    'default' => [
        'host' => env('REDIS_HOST', '127.0.0.1'),
        'password' => env('REDIS_PASSWORD', null),
        'port' => env('REDIS_PORT', 6379),
        'database' => 0,
    ],

2 个答案:

答案 0 :(得分:0)

尝试: public void readAllFromXLS() { Excel.Application refExcel = new Excel.Application(); Excel.Workbook refFile = refExcel.Workbooks.Open(Application.StartupPath + "\\Resources\\reference files\\price list.xlsx"); try { string workSheet; if (Form1.sesion.isSRA) workSheet = "SRA"; else workSheet = "Standard"; Excel.Worksheet refSheet = refFile.Sheets[workSheet] as Excel.Worksheet; for (int row = 2; row <= refSheet.UsedRange.Rows.Count; row++) { Some Cell Reading Here... } GC.Collect(); GC.WaitForPendingFinalizers(); Marshal.FinalReleaseComObject(refSheet); } catch (Exception e) { DialogResult r = MessageBox.Show("Price List Excel File Error.", "File Read Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); Console.WriteLine("------"); Console.WriteLine(e); } GC.Collect(); GC.WaitForPendingFinalizers(); Marshal.FinalReleaseComObject(refFile); refExcel.Quit(); Marshal.FinalReleaseComObject(refExcel); } 到数据库配置部件中的'strict' => true,

答案 1 :(得分:0)

我最终闯入宅基流浪者盒并运行'artisan migrate:install',解决了我的大部分问题。然后,我必须创建一个部分由laravel生成的数据库模式,其余部分由我自己编辑。