I created a database called learning-laravel and I created a table which is users I want to get data from that table I wrote this code block:
Route::get('/',function()
{
$users = DB::table('users')->get();
return $users;
});
but I'm getting this type of error:
PDOException
SQLSTATE[HY000] [2005] Unknown MySQL server host 'localhost:3306' (2)
*/
public function createConnection($dsn, array $config, array $options)
{
$username = array_get($config, 'username');
$password = array_get($config, 'password');
return new PDO($dsn, $username, $password, $options);
}
localhost:8889