Answer the question
In order to leave comments, you need to log in
Laravel, database connection issue?
When I try to migrate I get the following errors:
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)
new PDO('mysql:host=127.0.0.1;dbname=kurusa_test', "kurusa_main", "password");
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;
}
return new PDO($dsn, $username, $password, $options);
return new PDO('mysql:host=127.0.0.1;dbname=kurusa_test', "kurusa_main", "password");
Answer the question
In order to leave comments, you need to log in
Why are you writing directly? There is also a connection configuration file. And use it.
Lara works through named connections from .env, that's exactly what happens to you. Read the manual about setting up a database connection. Migrations work exactly through the standard mechanism if you do not use specific connections when describing the migration.
PS No offense, but this is exactly the case as from a joke - And where is the mistake? In DNA.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question