I make php artisan make:auth and tried to register as a new user then I get the error. I am using Xampp for MySQL and make a database name 'pari' and set user: root and password: root. After starting xampp apache and SQL server and PHP artisan serve on cmd I get the same error every time.
SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) (SQL: select count(*) as aggregate from
users
where
Step 1: I have changed .env file
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=pari
DB_USERNAME=root
DB_PASSWORD=root
and restart using php artisan serve , but again it gave that error.
Step 2: I have changed config\database.php to-
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'pari'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', 'root'),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => true,
'engine' => null,
],
but it again gave that same error. Step 3: I tried
php artisan cache:clear
php artisan config:clear
but again get same error.
Step 4: After removing password from phpmyadmin and .env and database.php I get new error-
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'pari.users' doesn't exist (SQL: select count(*) as aggregate from `users` where `email` = avinashjk1620@gmail.com)
How can i fixed this error Please help me.
Make sure your database was created using utf8mb4_unicode_ci
collation. This should fix your 1071 error.
Alternatively you can add Schema::defaultStringLength(191);
to your boot()
method in app\Providers\AppServiceProvider.php
.
Edit: Make sure to add use Illuminate\Support\Facades\Schema;
.