Задать вопрос
@Kurusa

Laravel, проблема с подключением к БД?

5b83201caa3b8758899753.pngПри попытке миграции получаю такие ошибки:

In Connection.php line 664:
SQLSTATE[HY000] [1045] Access denied for user 'kurusa_main'@'localhost' (using password: YES) (SQL: select * from information_schema.tables where table_schema = kurusa_test and table_name = migrations)


In Connector.php line 67:
SQLSTATE[HY000] [1045] Access denied for user 'kurusa_main'@'localhost' (using password: YES)


Я уверена на 100%, что данные для подключения к БД верны. Пробовала выполнить у себя на сервере
new PDO('mysql:host=127.0.0.1;dbname=kurusa_test', "kurusa_main", "password");

- успешно.

Не пойму что не так. B Connection.php line 664:

throw new QueryException(
            $query, $this->prepareBindings($bindings), $e
        );


Контекст кода таков:

protected function runQueryCallback($query, $bindings, Closure $callback)
{
    // To execute the statement, we'll simply call the callback, which will actually
    // run the SQL against the PDO connection. Then we can calculate the time it
    // took to execute and log the query SQL, bindings and time in our memory.
    try {
        $result = $callback($query, $bindings);
    }

    // If an exception occurs when attempting to run a query, we'll format the error
    // message to include the bindings with SQL, which will make this exception a
    // lot more helpful to the developer instead of just the database's errors.
    catch (Exception $e) {
        throw new QueryException(
            $query, $this->prepareBindings($bindings), $e
        );
    }

    return $result;
}


В Connector.php line 67:

return new PDO($dsn, $username, $password, $options);


Вместо этого пробовала написать свой вариант:

return new PDO('mysql:host=127.0.0.1;dbname=kurusa_test', "kurusa_main", "password");


Так же безуспешно.
  • Вопрос задан
  • 795 просмотров
Подписаться 1 Простой 1 комментарий
Ответ пользователя Ariurn К ответам на вопрос (3)
@Ariurn
Попробуйте вместо 127.0.0.1 указать localhost.
Ответ написан
Комментировать