DB_PASSWORD= ???
[PDOException] SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES)
I created database that's name is school I configured .evn is correct..? APP_ENV=local APP_DEBUG=true APP_KEY=4fnrrl4Y1qSSEoe7Q25royjK1fzJ9KB2 APP_URL=http://localhost
DB_CONNECTION=mysql DB_HOST=localhost DB_PORT=3306 DB_DATABASE=school DB_USERNAME=root DB_PASSWORD=
CACHE_DRIVER=file SESSION_DRIVER=file QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379
MAIL_DRIVER=smtp MAIL_HOST=mailtrap.io MAIL_PORT=2525 MAIL_USERNAME=null MAIL_PASSWORD=null MAIL_ENCRYPTION=null
my app/config/database.php is correct..? 'mysql' => array( 'driver' => 'mysql', 'host' => 'localhost', 'database' => 'school', 'username' => 'root', 'password' => 'toor', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', ),
Need some more information about your environment. Are you using a VM? Valet? MAMP/XAMP?
Have you created a mysql user account for the database with the credentials you are using?
@jaydeluca I am using xampp 7.1.6 in windows.. Actually I am using existing project..So yes there is one user account for an admin..
@aurawindsurfing "DB_PASSWORD=??" I applied earlier but It also gave an error in xampp..It did't start(xampp).. So I reinstall xampp & install new version..but it also didn't work.
if you are accessing the site from another computer , it is better way to create a mysql user . sometimes root access is forbidden from outside link , windows case.
@MaverickChan Thanks for guide...But Problem is that I don't have another computer so..Is it possible to another way to use this..
run
composer dumpautoload
then
php artisan cache:clear
@MaverickChan I use this now..but It did't work It gives warining
composer dumpautoload Generating autoload files Warning: Ambiguous class resolution, "formfoo" was found in both "C:/Users/Gaurav Janiyani/Desktop/School/school-management-system/app/controllers/admissionController.php" and "C:/Users/Gaurav Janiyani/Desktop/School/school-management-system/app/controllers/attendanceController.php", the first will be used. Warning: Ambiguous class resolution, "formfoo" was found in both "C:/Users/Gaurav Janiyani/Desktop/School/school-management-system/app/controllers/admissionController.php" and "C:/Users/Gaurav Janiyani/Desktop/School/school-management-system/app/controllers/gradesheetController.php", the first will be used. Warning: Ambiguous class resolution, "formfoo" was found in both "C:/Users/Gaurav Janiyani/Desktop/School/school-management-system/app/controllers/admissionController.php" and "C:/Users/Gaurav Janiyani/Desktop/School/school-management-system/app/controllers/libraryController.php", the first will be used. Warning: Ambiguous class resolution, "formfoo" was found in both "C:/Users/Gaurav Janiyani/Desktop/School/school-management-system/app/controllers/admissionController.php" and "C:/Users/Gaurav Janiyani/Desktop/School/school-management-system/app/controllers/markController.php", the first will be used. Warning: Ambiguous class resolution, "formfoo" was found in both "C:/Users/Gaurav Janiyani/Desktop/School/school-management-system/app/controllers/admissionController.php" and "C:/Users/Gaurav Janiyani/Desktop/School/school-management-system/app/controllers/studentController.php", the first will be used.
C:\Users\Gaurav Janiyani\Desktop\School\school-management-system>php artisan cache:clear Application cache cleared!
C:\Users\Gaurav Janiyani\Desktop\School\school-management-system>php artisan serve Laravel development server started on http://localhost:8000 ^C C:\Users\Gaurav Janiyani\Desktop\School\school-management-system>php artisan migrate
[PDOException] SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES)
migrate [--bench [BENCH]] [--database [DATABASE]] [--force] [--path [PATH]] [--package [PACKAGE]] [--pretend] [--seed]
then there is one possibility left : you forgot your password
flush the mysql root password
Set the password to empty string. like so ''
As i see in your database.php file you have enter some db password
'mysql' => array( 'driver' => 'mysql', 'host' => 'localhost', 'database' => 'school', 'username' => 'root', 'password' => 'toor', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', ),
but in the above comment you mention you dont have password for root user it should be something like this
'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' => false,
'engine' => null,
],
Also make sure the credential you provided in the env file are correct
@nanadjei2, @shakti it's also not work...So Now I am Upgrading from 4.2 to 5..Its might be work..
what error you get.
can you show me your env and database.php file so that i can check whats wrong
before writting the code please add ``` so that it could be readable
@shakti [PDOException] SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) This error I get in cmd every time after I write php artisan migrate..
My database.php file:
'mysql' => array(
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'school',
'username' => 'root',
'password' => '',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
),
And my .env file:
APP_DEBUG=true
APP_KEY=4fnrrl4Y1qSSEoe7Q25royjK1fzJ9KB2
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=school
DB_USERNAME=root
DB_PASSWORD=
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
please change your database.php by following code
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'school'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
],
then do
php artisan config:clear
@shakti As u say.. After Changes I use
php artisan config:clear
it's gives
Command "config:clear" is not defined.
Did you mean one of these?
cache:clear
auth:clear-reminders
config:publish
So can I use cache:clear..?? or else
sorry its config::clear
Thats gives an error..
Hi @shakti,
If you are using Laravel 5.4, the following command should clear your config...
php artisan config:clear
If it doesn't, try:
php artisan
and paste the result here.
Here is the result from mine:
$ php artisan
Laravel Framework 5.4.27
Usage:
command [options] [arguments]
Options:
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
--env[=ENV] The environment the command should run under
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Available commands:
clear-compiled Remove the compiled class file
down Put the application into maintenance mode
env Display the current framework environment
help Displays help for a command
inspire Display an inspiring quote
list Lists commands
migrate Run the database migrations
optimize Optimize the framework for better performance
serve Serve the application on the PHP development server
tinker Interact with your application
up Bring the application out of maintenance mode
app
app:name Set the application namespace
auth
auth:clear-resets Flush expired password reset tokens
cache
cache:clear Flush the application cache
cache:forget Remove an item from the cache
cache:table Create a migration for the cache database table
config
config:cache Create a cache file for faster configuration loading
config:clear Remove the configuration cache file
db
db:droptables Drop all tables in current database
db:seed Seed the database with records
debugbar
debugbar:clear Clear the Debugbar Storage
entrust
entrust:migration Creates a migration following the Entrust specifications.
event
event:generate Generate the missing events and listeners based on registration
ide-helper
ide-helper:generate Generate a new IDE Helper file.
ide-helper:meta Generate metadata for PhpStorm
ide-helper:models Generate autocompletion for models
key
key:generate Set the application key
make
make:auth Scaffold basic login and registration views and routes
make:command Create a new Artisan command
make:controller Create a new controller class
make:event Create a new event class
make:form Create a form builder class
make:job Create a new job class
make:listener Create a new event listener class
make:mail Create a new email class
make:middleware Create a new middleware class
make:migration Create a new migration file
make:model Create a new Eloquent model class
make:notification Create a new notification class
make:policy Create a new policy class
make:provider Create a new service provider class
make:request Create a new form request class
make:seeder Create a new seeder class
make:test Create a new test class
migrate
migrate:install Create the migration repository
migrate:refresh Reset and re-run all migrations
migrate:reset Rollback all database migrations
migrate:rollback Rollback the last database migration
migrate:status Show the status of each migration
notifications
notifications:table Create a migration for the notifications table
queue
queue:failed List all of the failed queue jobs
queue:failed-table Create a migration for the failed queue jobs database table
queue:flush Flush all of the failed queue jobs
queue:forget Delete a failed queue job
queue:listen Listen to a given queue
queue:restart Restart queue worker daemons after their current job
queue:retry Retry a failed queue job
queue:table Create a migration for the queue jobs database table
queue:work Start processing jobs on the queue as a daemon
route
route:cache Create a route cache file for faster route registration
route:clear Remove the route cache file
route:list List all registered routes
schedule
schedule:run Run the scheduled commands
session
session:table Create a migration for the session database table
storage
storage:link Create a symbolic link from "public/storage" to "storage/app/public"
vendor
vendor:publish Publish any publishable assets from vendor packages
view
view:clear Clear all compiled view files
HTH, Bud
Hii @manzwebdesigns, I upgraded my existing project 4.2 to 5.4.. So I Created new 5.4 Project & Copy paste controllers,models,views, changes in database.php file & also copy paste from database folder(migrations,seeds) & also copy paste the route.php.
So Now I run Project using
https://laracasts.com/discuss/channels/laravel/upgrading-issue-42-to-54
I got an Error..
Can you help to solve this problem..?
Hi @gauravjaniyani,
How far are you along in the design/development process? If you don't have a whole bunch done, it would be easier to start with a fresh install of 5.4 and then implement the changes in that.
Bud
Hi, I am getting the same error, however I have now setup any password. Following are my .env and database.php files configurations:
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
],
and the .env file
DB_HOST=localhost DB_DATABASE=forge DB_USERNAME=forge DB_PASSWORD=''
CACHE_DRIVER=file SESSION_DRIVER=file QUEUE_DRIVER=sync
MAIL_DRIVER=mail MAIL_HOST=mailtrap.io MAIL_PORT=2525 MAIL_USERNAME=null MAIL_PASSWORD=null MAIL_ENCRYPTION=null MAIL_PRETEND=false
I am very new to the laravel framework so any little help would be appreciated alot!
Thanks in advance
Please or to participate in this conversation.